0
Mark the following declarations as correct/incorrect
string ‘student’; float Double; int double; double username char ‘a’;
5 Antworten
+ 3
confused variable name assignment...
string ‘student’;
//incorrect. String not string. cannot use '' in variable name.
String student;
//suggested correction
float Double;
//valid. but confusing and not recommended because double is a reserved keyword and capitalized variables are generally used for class names.
float average;
//suggest a more practical name.
int double;
//incorrect. double is a reserved keyword and must not be used as variable name.
double username
//incorrect. it is not properly terminated with a semicolon ";"
double username;
//suggested correction
//char ‘a’;
//incorrect. cannot use '' in variable name.
char a;
//suggested correction
+ 3
but you still try to be diligent to think and show your opinion
+ 1
Try to run it and the compiler will tell you if they are not valid. You can just start a new Java code bit on Sololearn for that.
As far as I can tell only 1 line is valid (although it is not encouraged).
0
Hi! it is interesting to see what your opinion on this matter is. share?
0
It's an assignment and I'm not completely sure about my answers