Thanks a lot friends for patiently replying to all my naieve questions.
Just one final question.
Tell me which of my understanding is true :
1)one java file can have as many classes as we want but only one class can be public and that should have main method also the name of the java file will be the name of the public class ie the class which has main.
2)one java file can have as many classes as we want and also as many public classes as we want and out of these public classes one should hav the "main" and the name of the java file will be the nameof the public class having main ().