1> Save any java program with .java extension only.

2> In a source file we can have as many import statement but is should be 2nd statement if there is any package statement.

3> Any package statement must be the first statement otherwise compiler will give compilation error.

4> Class file will be generated for any many class defined in a single source file .
For ex- a program has 3 classes then compiler will create 3 .class file

5> Its not mandatory to have main method in a class. But if we have any class with main() then it will compiler successfully but JVM fails to execute the .class file because of no main() definition.

6> If we try to execute any class without main() then JVM will give "NoSuchMethodError ".

7> For any java source file main() is the starting point of executing the program for the JVM.

8> We cannot have more than one public class in a single java program.

9> If there is a public class then its mandatory to save the file with the name of the class followed by .java extension but can execute any class.

10> If there is no public class in our program then we can save it with any class name and can able to execute any class but the class must have main() other JVM will give " NoSuchMethodError ".

11> One program can have more than one main () but each class can have only one main().

12> If we have more than one class and in every class we have defined a main() then the only main() from the specified class will be executed.

13> One class can have only one class / interface definition and can have any number of non-public class definition.

14> Its not mandatory to have main() in public class only. We can have main() in non-public class as well but the execution of main() depend upon the specified main() while executing the program.



0 comments:

Post a Comment

Blog Archive

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

Online Members

Live Traffic