aspose file tools
The moose likes Java in General and the fly likes How the control flows through the Java program during compilation? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How the control flows through the Java program during compilation?" Watch "How the control flows through the Java program during compilation?" New topic
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
    
    6

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
    
    6

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How the control flows through the Java program during compilation?
 
Similar Threads
mock question from appliedreasoning.com
OVERRIDING ISSUES
method overloading issues
Using of final keyword
Program Execution Flow.