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
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 |
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 |
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 |
What are the advantages of compiled language?
design an lru cache in java?
What is the difference between Synchronizing mehtod & Synchronizing block?
Explain thread in java?
Why arraylist is not synchronized in java example?
What are virtual functions?
How big is a gigabyte?
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.
what is tempplate pattern
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?