Which of the options are correct for the following code?
public class Main { // line 1 public static void main(String[] args) { // line 2 char a = 'a'; // line 3 char b = -10; // line 4 char c = '1'; // line 5 integer d = 1; // line 6 System.out.println(++a + b++ * ++c-- - d); // line 7 } // line 8 } // line 9
a, c, d
A is correct. The code at line 4 fails to compile because you can't assign a negative value to a char data type without casting.
C is correct. There is no primitive data type with the name "integer." The valid data types are int and Integer.
D is correct. The variable d remains undefined on line 7 because its declaration fails to compile on line 6.