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 procedure overloading?
How to overcome the exception object reference not set to an instance of object?
What is double in java?
What is fail fast in java?
Explain the difference between the public, private, final, protected, and default modifiers?
What is a lightweight component?
What is use of static method?
What does || mean in code?
How do you reverse a word in java?
How to disable caching on back button of the browser?
What is unmodifiable list in java?
What is the purpose of the system class in java programming?
Is singleton thread safe in java?
Difference between keyword and identifier.
Is null keyword in java?