What is the result of the following class? (Choose all that apply)
1: public class Main { 2: private static int $; 3: public static void main(String[] main) { 4: String My_Value; 5: System.out.print($); 6: System.out.print(My_Value); 7: } 8:}
E.
E is correct because local variables require assignment before referencing.
D is incorrect because class and instance variables have default values and allow referencing.
My_Value defaults to a null value.
Options A, B, and C are incorrect because identifiers may begin with a letter, underscore, or dollar sign.
Options F and G are incorrect because the code does not compile.
If My_Value was an instance variable, the code would compile and output 0 null.
The following code changes the My_Value to instance variable.
public class Main { private static int $; private static String My_Value; public static void main(String[] main) { System.out.print($); System.out.print(My_Value); } }
The code above generates the following result.