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


Please Help Members By Posting Answers For Below Questions

Explain the difference between intermediate and terminal operations in java8?

576


what happens when a thread cannot acquire a lock on an object? : Java thread

545


What is the difference between stringbuffer and stringbuilder class?

578


What is a lightweight component?

600


When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?

767






What does serializing data mean?

525


What is an empty list in java?

534


What is the meaning of nullable?

580


What is a protected class in java?

546


How do you calculate roots in java?

527


Name component subclasses that support painting in java programming?

642


What is math floor in java?

477


What is final keyword?

649


What are the steps involved to create a bean?

685


What is runtime polymorphism or dynamic method dispatch?

526