| Author |
How the control flows through the Java program during compilation?
|
Tabassum Momin
Greenhorn
Joined: Oct 10, 2012
Posts: 5
|
|
Hello everyone, I would like to know about how the control flows, while compiler compiles the JAVA program
Let me take a simple example.
public class Demo
{
public static void main(String arr[])
{
Test tst= new Test(); // line 5
tst.display(); // line 6
}
}
class Test
{
void display()
{
System.out.println("Hello");
}
}
-->I would like to know that when compiler come across line 5 and 6, how does it come to know that the class Test and it's method display() exist.
|
 |
lavnish lalchandani
Ranch Hand
Joined: Feb 28, 2007
Posts: 78
|
|
go thru this
http://www.coderanch.com/t/386392/java/java/Java-Compiler-JVM-Works
HTH
|
lavnish.blogspot.com
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
Here is your code, properly formatted in code tags:
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
|
When it gets to lines 5 and 6, it DOESN'T know that the class and method exist. But it's not to hard to say "Well, I better be able to figure it out before I'm done. I'll just remember these two things, and I'll check again before I'm done looking at everything else that they are somewhere.".
|
 |
Tabassum Momin
Greenhorn
Joined: Oct 10, 2012
Posts: 5
|
|
Thank you
|
 |
 |
|
|
subject: How the control flows through the Java program during compilation?
|
|
|