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
Explain the difference between intermediate and terminal operations in java8?
what happens when a thread cannot acquire a lock on an object? : Java thread
What is the difference between stringbuffer and stringbuilder class?
What is a lightweight component?
When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?
What does serializing data mean?
What is an empty list in java?
What is the meaning of nullable?
What is a protected class in java?
How do you calculate roots in java?
Name component subclasses that support painting in java programming?
What is math floor in java?
What is final keyword?
What are the steps involved to create a bean?
What is runtime polymorphism or dynamic method dispatch?