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

How many types of flags are there?

528


What's the difference between comparison done by equals method and == operator?

550


What are the basic interfaces of java collections framework?

611


Explain about main() method in java ?

590


What is the exact difference in between unicast and multicast object? Where we will use?

566






List two java ide’s?

619


Is it possible to compare various strings with the help of == operator? What are the risks involved?

624


What is the original name of java?

546


What is remote method invocation (rmi)?

617


How many bytes is 255 characters?

557


What is the meaning of 3 dots in java?

688


Explain how to convert any java object into byte array.

558


What is arrays aslist in java?

527


What is the use of math abs in java?

554


Is the empty set a singleton?

544