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 is encapsulation in java?
Can set contain duplicates?
Why are getters and setters used?
How do you decide when to use arraylist and linkedlist?
Can we start a thread twice in java?
Why is java called java?
What is comparator in java?
Is stringwriter thread safe?
What happens if an exception is throws from an object's destructor?
What is number data type in java?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
Give few examples of final classes defined in Java API?
What is a class instance variable?
What is the difference between exception and error in java?
Which is better list or arraylist in java?