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 is string in java with example?
explain copyonwritearraylist and when do we use copyonwritearraylist?
How do you sort in ascending order in java?
Explain what are final variable in java?
What is java jit compilers?
What is diamond operator in java?
What is a heavyweight component?
What do you mean by mnemonics?
Is null or empty java?
What is the use of beaninfo?
What is a values collection view ?
What is the indent key?
What is unicode with example?
What is fail first in java?
What is == and === in javascript?