Can u overload main()method.Give with example.
Answer Posted / rama krishna dwadasi
Yes, We can overloaded main method also,,,,but JVM start
execution from main method with parameters of String args[]
only...so below example output is "Inside second method"
Example:
public class OverloadMain {
public static void main(int a[]) {
System.out.println("Inside first Main Method");
}
public static void main(String args[]) {
System.out.println("Inside Second Method");
}
}
| Is This Answer Correct ? | 51 Yes | 5 No |
Post New Answer View All Answers
Why convert an applet to an application?
What is contractor means and methods?
Why doesn't the java library use a randomized version of quicksort?
Which number is denoted by leading 0x or 0x in java?
What is the primary benefit of encapsulation?
What is a dot notation?
Can you make a constructor final?
What is regex in java?
What is extension method in java?
How do you replace all in word?
What is operator overloading. Is it is supported in java?
Can we write multiple catch blocks under single try block?
Differentiate between postfix and prefix operators in java.
What is string intern in java?
In the below example, what will be the output?