6 years ago in Java Strings

What is the output of the code ?
public class AQuestion{

private int i = j;

private int j = 10;

public static void main(String args[]){

System.out.println((new AQuestion()).i);

}

}

[A] Compiler error complaining about access restriction of private variables of AQuestion.
[B] Compiler error complaining about forward referencing.
[C] No error - The output is 0;
[D] No error - The output is 10;
Loading...
Next Question

Create your Digital Resume For FREE on your name's sub domain "yourname.wcard.io". Register Here!


Overall Stats

Attempted 155
Correct 40
Incorrect 54
Viewed 61

Answers

Guest
Guest
Kuheli Mitra
Kuheli Mitra - 4 years ago

Kuheli Mitra from Bangalore, India is saying Compiler error complaining about forward referencing. is correct answer

pooja kadam
pooja kadam - 4 years ago

pooja kadam from Pune, India is saying Compiler error complaining about forward referencing. is correct answer

Dimana Ignatova
Dimana Ignatova - 4 years ago

Dimana Ignatova from Sofia, Bulgaria is saying Compiler error complaining about forward referencing. is correct answer

Arpit Khare
Arpit Khare - 4 years ago

Arpit Khare from Indore, India is saying Compiler error complaining about forward referencing. is correct answer

ranjani kala
ranjani kala - 4 years ago

ranjani kala from Chennai, India is saying Compiler error complaining about forward referencing. is correct answer

Related Questions

String is an________

  • [A] class
  • [B] Variable
  • [C] Array
  • [D] Data type

What will happen if you try to compile and run the following code ?
public class MyClass {

    public static void main(String arguments[]) { 

    }

    public void amethod(String[] arguments) { 

    }

}

  • [A] error Can't make static reference to void method.
  • [B] error method main not correct
  • [C] error array must include parameter
  • [D] amethod must be declared with String