Q What is wrong with the following variable declarations int
Q. What is wrong with the following variable declarations?
int Km/h = 120;
String Newcar = GMC;
int Adouble = “50”;
String newCar = “GMC”
int x = 5, y = “x”;
String new Car = “GMC”;
I need the answer to be copied to Word not a picture.
Solution
int Km/h = 120; // syntax error on token \'/\'
String Newcar = GMC; //GMC cannot be resolved. place \"GMC\" then error resolved
int Adouble = \"50\"; //Type mismatch. cannot convert from string to int. remove this \"\" then error resolved
String newCar = \"GMC\"; //no error
int x = 5, y = \"x\"; //Type mismatch. cannot convert from string to int. only value will be declared for y because it is int. then error resolved
String new Car = \"GMC\"; //new is a keyword. remove new keyword. new is used for creation of new object
