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 |
Can you explain the difference b/n abtract and interface with a good example,?In what cases we have use abtract and what case interface?
Why do we use public static with the main function in Java?
13 Answers College School Exams Tests, Infosys,
In Java, what’s the purpose of static methods and static variables?
What is use of super keyword?
Which of the classes will have more memory allocated?
What is jagged array in java?
Marker interface means , interface which has no methods.Then what is the necessity of its usage.I read "it tells the compiler that it should be treated differently ". "It is used to store state of an object". But still am not clear.Please explain clearly.
What is meant by class and object in java?
Why java is object oriented?
What is the difference between access specifiers and access modifiers in java? 16
How do you calculate roots in java?
Can you run the product development on all operating systems ?