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 are the restrictions that are applied to the java static methods?
What is size of int in java?
Difference between ‘is-a’ and ‘has-a’ relationship in java?
What is type conversion in java?
What is treeset and treemap in java?
What is meant by class loader? How many types are there?
What is matcher in java?
When does an object becomes eligible for garbage collection in java?
What are the important methods of java exception class?
Write an algorithm program in java for the following question.. In a VLSI design techniques,they used rectangles to design circuits. EVery rectangle is to be placed according to x,y coordinates. Check whether or not two rectangles overlap each other. Here overlapping of rectangles is acceptable, if 1) one rectangle intersect with other. 2) one rectangle fully covers other. The time of algorithm should not exceed o(n logn).
Why string is immutable or final in java
What is a local block?
What is the return type of the main method?
Why vector class is used?
What happens when heap memory is full?