fork download
  1. public class Exam1 {
  2. private int a;
  3.  
  4. public static void main(String arg[]){
  5. /*Complete the code using the options so that 0 is printed in console*/
  6. System.out.println(a);
  7.  
  8. } }
  9. /*a) System.out.println(a);*/
  10. /* b) System.out.println(new Exam1().a);*/
  11. /*c) int a; System.out.println(a);*/
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Exam1 is public, should be declared in a file named Exam1.java
public class Exam1 {
       ^
Main.java:6: error: non-static variable a cannot be referenced from a static context
      System.out.println(a);  
                         ^
2 errors
stdout
Standard output is empty