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 Method and class used for Connection pooling ?
Explain the use of sublass in a java program?
How do you use compareto method?
Explain creating threads by extending thread class ?
How many types of literals are there in JAVA?
What is the difference between static class and normal class?
What is the default value of local and global variables?
What is difference between abstract class & final class
How strings are created in java?
Can there be an abstract class with no abstract methods in it?
What is diamond operator in java?
whats is inheritance?
15 Answers CTS, HCL,