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
How do you sort in descending order in java using collections sort?
Are primitives objects?
How is java hashmap implemented?
What is meant by method overriding?
What is jvm? How its run?
What is public static void main?
how can i use a nonsynchronized hashtable?
What is the difference between stored procedure & function?
What is generic class?
Can you declare the main method as final?
What does replaceall do in java?
Given a singly linked list, determine whether it contains a loop or not without using temporary space?
Can we inherit a class with private constructor?
Explain static nested classes ?
How do you write a scanner class in java?