I declared main() method as private. But it still running
and displaying the output. Please Answer it .
Code Snippet as Below:
import java.io.*;
class over
{
private static void main(String[] args)
{
int high = Integer.MAX_VALUE;
int overflow = high + 1;
int low = Integer.MIN_VALUE;
int underflow = low - 1;
System.out.println(high + "\n" +overflow +"\n"+
low +"\n"+underflow);
//System.out.println(overflow);
//System.out.println(low);
//System.out.println(underflow);
}
}
Answer Posted / bhavya
Since main method is made private JVM does not find the main class, so it says there is no main method.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What does exclamation mean in java?
Is static variable stored in heap?
Differences between external iteration and internal iteration?
Define an applet in java?
What is the purpose of the system class in java?
What is static and final keyword in java?
What is get () in java?
What is java life cycle?
Is java se free?
Is a copy constructor?
Can a class extends itself in java?
What is identifier give example?
What is the do while loop syntax?
What is difference between call by value and call by reference?
Is special character in java?