Rajat Singhal

Greenhorn
+ Follow
since Nov 28, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajat Singhal

hi Michael,
congratz, specially for your brilliant score.
i m also preparing for SCJP 1.5 ..plzz guide me..i will take it in a month.
sample questions needed.
thanks
16 years ago
hi Michael,
congratz, specially for your brilliant score.
i m also preparing for SCJP 1.5 ..plzz guide me..i will take it in a month.
sample questions needed.
thanks
hi all
here is the program:

class Test
{
private int i = getJ();
private int j = 10;

int getJ()
{
return j;
}

public static void main(String [] args)
{
System.out.println(new Test().i)
}

Output : what you expect?

here if we directly assign j to i it will give forward referencing error(which is fine and expected) . But here also there must be an error regarding forward reference. And the more wierd thing is that it is giving out put : 0 not even 10 !!