sir Govinda,
It's ok.I'm working on it myself.but why did you delete your
old reply.
quote__________________________________________________
Dear Nasir
Here is Nothing to sorry
I just want to know because of your post Heading
-------how java compiler works-------------
for your information I am a SCJP(98%). and that one question
which is wrong accrding to sun is not wrong accrding to me. because they required three ans for that question and according to me only two of the given ans shall be correct. i write a mail in this concerns to Sun , let see what happens. And Now your problum , the reason for your problum is "forward referencing " . because of that your code didn't compile. and generally people
didn't understand properly what forward referencing means and how it cause impact on the code. have a look to the following code. this code also uses forward referencing but allowe by compiler. these kind of problums is almost occured because of not trying to get the "FEEL" of java by persons who code in java.
class amazed {
int getValue() {
System.out.println("trying to give value of variable which not yet declared");
return i; //this variable is not declared yet
}
//int j = i; // enabling this line made compiler barking.
int i;
}
actully forward referecing is allowed by compiler upto some extent . this extent is decided by compiler itself and vary from compiler to compiler. basiclly a compilation process
consist of a number of passes & phases, like Lexical analysis, tokenizing , parsing , generation of intermediate code etc.
but before i tell you what is the reason for barking compiler to your code i must know about your educational backgroung(from which stream or branch you are graduate or post graduate) . because explaination of compilation process involves some such kind of terms which cannot (possibely) be interprated by non technical person. so i must know about your educational background. then after i can easily decide from where & how to
start explaination.
One more thing i want to made in your knowledge that i am a very rude & proudy & arrogant & etc person , so if you want to communicate with me then some time it might possible that my words bite you. if you are agree to bear that then reply me the seeking information in the same
thread otherwise don't. mind one thing as you say you are learning here and according to me i am teaching you. so you have to follow my agreement.
if you get me positively then reply......
waiting for reply .........
____________________________________________________