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
Is namespace same as package in java?
Difference between character constant and string constant in java ?
What is meant by string is immutable?
What do you understand by garbage collection in Java? Can it be forced to run?
What is increment in java?
How does multithreading take place on a computer with a single cpu?
Can we serialize arraylist in java?
Is 9 a prime number?
What is difference between checked and unchecked exception in java?
What is the difference between member variables initialization and assignment in a constructor?
What will be the initial value of an object reference which is defined as an instance variable?
List some features of the abstract class.
How does a cookie work in Servlets?
What is boolean data type in java?
What is append in java?