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
Name the components that are termed to be Heavy-weight component but available in Light-weight components?
How are variables stored?
What is mean by exception?
How much is a java license?
Can you pass by reference in java?
What is a Transient Object?
Can we have any code between try and finally blocks?
What are the restriction imposed on a static method or a static block of code?
Which data type is class in java?
What is the meaning of find and replace?
What is super keyword explain with example?
What is the base class of all exception classes?
Can a private method of a superclass be declared within a subclass?
What are desktop procedures?
How many types of operators are there?