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

What are the advantages of compiled language?

0 Answers  


design an lru cache in java?

0 Answers  


What is the difference between Synchronizing mehtod & Synchronizing block?

2 Answers  


Explain thread in java?

0 Answers  


Why arraylist is not synchronized in java example?

0 Answers  






What are virtual functions?

2 Answers  


How big is a gigabyte?

0 Answers  


why the wait,notify,notifyall methods are placed in object class?these are the thread concepts why these methods are placed in Object class?

2 Answers   Global Logic, Satyam,


What is a package in java? List down various advantages of packages.

0 Answers  


what is tempplate pattern

4 Answers   IBM, RBS,


how to prepare for IT Officers Interview in Banks

0 Answers   TATA, Tata Steel Limited,


What do you understand by garbage collection in Java? Can it be forced to run?

0 Answers   TCS,


Categories