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

Answer Posted / tushar

class Checkmain
{

public static void main(String args[])
{
System.out.println("helloCheckmain string main ");
}
}

class Checkmain1 extends Checkmain
{
public static void main(String args[])
{
System.out.println("helloCheckmain1 string main ");
}
}

public class Main
{
public static void main(String args[])
{
String S[]=new String[10] ;
System.out.println("******string main**********");
int q=10;
main(q);
Checkmain.main(S);
Checkmain1.main(S);
}

public static void main(int a
{
String S[]=new String[10] ;
System.out.println("000000000 int main 0000000000");
Checkmain.main(S);
Checkmain1.main(S);
}
}

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is procedure overloading?

1809


How to overcome the exception object reference not set to an instance of object?

630


What is double in java?

526


What is fail fast in java?

580


Explain the difference between the public, private, final, protected, and default modifiers?

559






What is a lightweight component?

602


What is use of static method?

543


What does || mean in code?

549


How do you reverse a word in java?

537


How to disable caching on back button of the browser?

535


What is unmodifiable list in java?

540


What is the purpose of the system class in java programming?

551


Is singleton thread safe in java?

558


Difference between keyword and identifier.

605


Is null keyword in java?

537