What is the output of this Java program? class Test { int i; } public class Main{ public static void main(String args[]){ Test t=new Test()…

What is the output of this Java program?

class Test {
    int i;
}
public class Main{
    public static void main(String args[]){
        Test t=new Test();
        System.out.println(t.i);
    }
}
  1. a) The program will cause a compile error because the object "t" was not initialized
  2. b) The program will cause a runtime exception because the variable "i" was not initialized
  3. c) A garbage value
  4. d) 0

From the Sonali Bank Assistant Database Administrator 2020 – Preliminary exam, question 24 of 68.

More from this paper