can we override the main() method in java????
Answers were Sorted based on User's Feedback
Answer / zameer
Yes we can override the main() method in java but that main() method are not declare static keyword.
If main() method is static then we can not override
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / rajkumar
Hi ,You have rights to overload main(),but jvm can invoke
only main with String[] s. not other arguments main.If u
come for override both sub class and super class can hold
its own main. any way we can't invoke main with help of
either object ref or super. but at compile time we can't get
any error suppose both super and sub has main
Is This Answer Correct ? | 4 Yes | 10 No |
What is hashmap and map?
Can you call one constructor from another if a class has multiple constructors?
what is synchronization? : Java thread
What is the purpose of main function in java?
What is the difference between jdk, jre, and jvm?
Can we access the non-final local variable, inside the local inner class?
Is it possible to write JAVA program without including any of the packages,such as "import java.io.*"; bcoz I instantly wrote a code without "import..." statement and runned the program on command Line & it worked. the code is: class Person { String name; int age; Person(String s,int a) { name = s; age = a; } accept() { System.out.println(name+"Hi!!!!!"); System.out.println(age); } } class Demo { public static void main(Strings args[])throws IOException { String name = args[0]; int age = Integer.parseInt(args[1]); Person p = new Person(name,age); p.accept(); } }
What is the synonym of string?
What is the properties class?
Can we write method inside a method in java?
Why we use protected in java?
What is sorting in java?