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
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
What are the 8 data types in java?
What are triggers in DB? Explain their types. How do they work?
Is java code slower than native code?
how does the run() method in runnable work? : Java thread
Can you override a final method?
Is an empty arraylist null?
What is the difference between normal report & matrix report?
What is <> used for in java?
How do constructors use this() and super()?
Can we define private and protected modifiers for variables in interfaces?
Explain what is Marker interface?
What is the purpose of the finally clause of a try-catch-finally statement in java programming?
what is singleton class in java?
Name few java 8 annotations ?