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...


class test
{
private static void main(String []adsf)
{

}
}

explain me that the above code is error or exception

Answers were Sorted based on User's Feedback



class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / bhargava

Code will throw exception. Because usually every stand
alone program execution should start with main method. It
should be public other wise this method doesnt exposed to
out side to run.

Is This Answer Correct ?    12 Yes 0 No

class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / sri

It will not generate any compile time error, but while
running the program it will generate the output as "main
method is not public".....

Is This Answer Correct ?    7 Yes 0 No

class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / xavier

This will throw a runtime error stating main method not public
This is because main method is the starting point of program
execution and it should be accessible by JVM

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Core Java Interview Questions

could you run the java program without main method?

6 Answers  


What is the difference between Synchronizing mehtod & Synchronizing block?

2 Answers  


Are primitives objects?

0 Answers  


What do you mean by aggregation?

1 Answers  


1).what is the difference between below examples String s="vijay"; String s=new String("vijay");

12 Answers   Mascon, Satyam, TCS,


how u do unit testing?

2 Answers   iFlex,


Are nested try statements are possible?

2 Answers  


Tell me the difference between an applet and a Japplet?

1 Answers  


What is an infinite loop in java? Explain with an example.

0 Answers  


What is a super class and how super class be called?

3 Answers  


If you do not want your class to be inherited by any other class. What would you do?

0 Answers  


when System.out.println("") is executed what happens in the back ground?

2 Answers  


Categories