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


Please Help Members By Posting Answers For Below Questions

What does exclamation mean in java?

571


Is static variable stored in heap?

505


Differences between external iteration and internal iteration?

570


Define an applet in java?

627


What is the purpose of the system class in java?

552






What is static and final keyword in java?

573


What is get () in java?

562


What is java life cycle?

533


Is java se free?

520


Is a copy constructor?

572


Can a class extends itself in java?

527


What is identifier give example?

549


What is the do while loop syntax?

551


What is difference between call by value and call by reference?

498


Is special character in java?

610