Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What happens when a main method is declared as private?

Answer Posted / sachin

JVM wants to execute the class its starting Execution from main Method means if JVM wants to execute main method if we declare main Method as private then its restriction the scope of main method if we declare Main Method as public then only jvm can applicable to access the main Method.
for e.g
class SE3
{
private static void main(String[] args)
{
System.out.prinln("Hello");
}
}
E:A_coreResearch_Programs>javac SE3.java

E:A_coreResearch_Programs>java SE3
Error: Main method not found in class SE3, please define the main method as
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we create an immutable class in java?

1017


What is a singleton in genetics?

1000


Can interface be private in java?

945


Are true and false keywords?

978


What are the types of strings?

980


Explain working of call by reference function invoking.

966


What is meant by class loader? How many types are there? When will we use them?

913


Differentiate between static and non-static methods in java.

996


What is __ init __ functions?

1037


Explain the Propertie sof class?

993


Why does java not support operator overloading?

1083


Differentiate storage classes on the basis of their scope?

1113


Explain differences between checked and unchecked exceptions in java?

1016


What is implicit object in java?

1023


Define interface in java?

1023