Whether Java compilation takes place in a program depending upon Class or whether it depends on Method?I would really like to know whether java compiler is looking for a method while it executes statements or whether it checks the Class containing it.Also how does java compilation takes place?Is java compilation done by:
- Loading the main Class
- Then loading other Classes
- Finally linking the classes which have references(variable in Class
Amight be referred in ClassB.
This doubt occured while I was trying to execute this program.The program was compiled but while I try to execute it says:Error: Could not find or load main class temp.The program just contains two Classes Start and Finish.The code is:
import java.io.*;
class Start
{
public static void main(String args[])
{
System.out.println("STARTING JAVA PROGRAM");
}
finish f=new finish();
}
class Finish
{
public void method()
{
System.out.println("FINISHING JAVA PROGRAM");
}
}
Could anyone help me in showing how the compilation of Java takes place in a ordered format or process?(What basic steps are done in Java Compilation?).
Aucun commentaire:
Enregistrer un commentaire