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
What is finally block?
What are classloaders?
how to write a program for sending mails between client and server
extending thread class or implementing runnable interface. Which is better? : Java thread
What is main function purpose?
What is string :: npos?
Can a static class have a constructor?
What is class forname used for?
What is use of a abstract variable?
Why is stringbuffer thread safe?
Can you explain the final method modifier?
What are the two types of exceptions in java? Which are the differences between them?
What is the main function in java?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
Is java call by reference?