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 / ravi ranjan
OUTPUT = NO SUCH A METHOD EXCEPTION
REGION= MAIN METHOD MUST BE PUBLIC BECAUSE IT CALLED BY THE
DEMON THREAD
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is sizeof () operator?
What is a war file?
Is java call by reference?
Which collection is sorted in java?
What do you know about the garbage collector in java?
What is difference between throw and throws ?
What is string immutability?
Which package is always imported by default?
How does compareto method work?
What happens to a static var that is defined within a method of a class?
Which object oriented concept is achieved by using overloading and overriding?
What is math in java?
How will you get the platform dependent values like line separator, path separator, etc., ?
What is tostring () method?
What are the uses of java?