Can u overload main()method.Give with example.

Answer Posted / aditya sharma

* Yes we can overload the main method.

File Name :- checkOverloadingMainMethod.java
Example: -

public class checkOverloadingMainMethod {

public static void main(int a[]) {
System.out.println("Overload =>Integer Array");
}

public static void main(String args[]) {
System.out.println("Overload => String Array");
}
}

Is This Answer Correct ?    120 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is java and why do we need it? Explain

587


Why do we need variables?

535


What is the different types of functions?

563


What is array sorting in java?

557


What is difference between final and immutable?

565






How many types of threads are there in java?

506


What is the use of java?

530


What do you mean by pointer value and address?

581


Why do we need strings in java?

530


I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?

578


What are three advantages of using functions?

540


How do you break a loop?

568


Explain the difference between comparator and comparable in java?

490


What is data structure in java?

543


What is finally in Java?

584