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

Is null == null in java?

662


What is string builder?

481


What is variable explain?

535


What is the use of parseint in java?

552


What is variable explain with example?

580






What language is pass by reference?

580


What is the difference between jfc & wfc?

605


Can we override constructor?

548


What is the difference between sleep and wait in java?

521


What is set and get methods in java?

553


Explain the importance of throwable class and its methods?

577


Is string a wrapper class?

521


What is java Applet?

656


What are functions in java?

508


Is a boolean variable?

525