What happens when the main() isn't declared as static?
Answer / nashiinformaticssolutions
When the main method is not declared as static, then the program may be compiled correctly but ends up with a severe ambiguity and throws a run time error that reads
| Is This Answer Correct ? | 0 Yes | 0 No |
How do I get a substring?
How to sort the elements in HashMap
What are the differences between string, stringbuffer and stringbuilder?
What is run-time class and system class? what is their purpose?
Can subclass overriding method declare an exception if parent class method doesn't throw an exception?
Can singleton class be cloned?
Is java based on c?
Consider that class classA, abstract class classB, and final classC have been defined.Which one of the following is correct? 1. classA extends classC implements classB 2. class A extends classB, classC 3. classA extends classB 4. classB implements classC
Explain the difference between getAppletInfo and getParameterInfo?
5 What is Java exception handling?
In Java why we write public static void main(String args[]) why not main()?
46 Answers Aptech, GE Healthcare, Infosys, Microsoft, New Horizon, Practical Viva Questions, TCS, Wipro,
ublic class Java_Coding_Samples { public static void JavaHungr(NumberFormatException ae){ System.out.println("integer"); } public static void JavaHungry(Exception e){ System.out.println("string"); } public static void JavaHungry(ArithmeticException ae){ System.out.println("object"); } public static void main(String[] args) { JavaHungry(null); }