public class AQuestion
{
private int i = giveMeJ();
private int j = 10;
private int giveMeJ()
{
return j;
}
public static void main(
String args[])
{
System.out.println((new AQuestion()).i);
}
}
The output is 0 in this case;
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 in this second case. In this case it can print 0, b'coz, first, i.e. b4 executing the constructor, the member variables R initialized to 0.
Pls explain
Thanks
kanchan