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

Is void a return type?

548


What’s the difference between callable and runnable?

543


How do singleton patterns work?

513


what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread

559


What is factor r?

518






Is there a sort function in java?

575


Can a static class have a constructor?

515


What is split return?

488


Write a program to print count of empty strings in java 8?

534


What is data object example?

525


What is fundamental datatype?

523


Difference between current previous versions of Java?

553


What are the 6 functions?

509


What do you understand by private, protected and public?

517


What is the purpose of the finalize() method?

704