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 / kumaresan.r
Hai,
When you compile program it will run with out error,bt it
did not show the value of high,low,underflow.it just show that
"Main method not public.
Process completed.".
So we cant say that this is an output.
| Is This Answer Correct ? | 15 Yes | 0 No |
Post New Answer View All Answers
What are instance variables?
Explain wait() method of object class ?
How will you call an Applet using Java Script Function?
What are the advantages and disadvantages of reference counting in garbage collection?
How do you test a method for an exception using junit?
How many boolean functions are there?
Explain about the select method with an example?
Why main method is called first in java?
What is meant by memory leak?
How do you create a null object?
What does void * mean?
What are void methods?
What is Java Annotations?
Why are global variables used?
define polymorphism in java