Sunday, 1 November 2020

Can an applicatoin have multiple classes having main method in same JAVA file ?

 

 

 

 

1.  Can an applicatoin  have multiple classes  having  main  method in same JAVA file ? 


Yes  it is possible . While  starting  the application  we mention the class name to be run .  The JVM  will look  for the Main  method  only  in the class whosw name  we have  mentioned . Here  there  is not  conflict  amongst  the multiple  classes  having  main ( ) method.






2. Give the name of  top class of all  classes  in java  and the top  package which  is the  default  package.


Top  class of all classes  in JAVA is object  class. 

Top package  which  is  default  package  in java .lang .package.














No comments:

Post a Comment

Student Marks Calculation app using java

      import javax.swing. *; import java.awt.event.ActionEvent ; import java.awt.event.ActionListener ; public class Student { private J...