Hi!
Please have a look at this.
I am missing something very simple in the second question, and am not able to figure out what!
(This is from Abhilash's
java quiz site (
http://www.angelfire.com/or/abhilash/Main.html))
Thanks
Rahul
<code>
public class AQuestion
{
private int i = j;
private int j = 10;
public static void main(
String args[])
{
System.out.println((new AQuestion()).i);
}
}
</code>
=====================================
Solution: Compiler error about forward referencing
=====================================
<code>
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);
}
}
</code>
=====================================
Solution: Compiles and prints 0 when run
=====================================