+ 1

Small question about lesson

String name ="David"; int age = 42; double score =15.9; char group = 'Z'; I understand the object being created (david) is having the variables set for him, such as his name, age put in as an integer. But what does the double score and char group represent exactly? Just a small question really. not too important I dont think.

12th May 2017, 3:59 AM
Mitchell Stallard
Mitchell Stallard - avatar
2 Réponses
+ 6
It can represent anything under this context. Maybe score is that players score in the game, while name and age is just account information. The important info here is that you understand the datatypes. Where string is for a list of characters, int is a whole number, double is a decimal, and char is a single character.
12th May 2017, 4:08 AM
Rrestoring faith
Rrestoring faith - avatar
+ 3
Object not is the correct definition for David, it is variable with name "name" of type string. For other hand, type double it is for assigning numeric values with decimal, like 1.34, 6.524 and so on. For last, type char it is for characters like 'a', 'b', etc. If you have another question, only ask :) Good luck!
12th May 2017, 4:14 AM
Alberto Del Angel
Alberto Del Angel - avatar