Is there is any error if you have multiple main methods in
the same class?
Answer Posted / aburar yaseen
we can use multiple main methods in a class by overloading
and not by the overriding. but the overriding is possible
in case of parent child combination.
example:
class xxx{
public static void main(String args[]){}
void main(){}
}
the above is called overloading.
example2;
class xxx{
public static void main(String args[]){}
}
class yyy extends xxx{
public static void main(String args[]){}
}
the above is overriding.
example3;
class xxx{
public static void main(String args[]){}
public static void main(String args[]){}
}
the example3 is not possible
}
| Is This Answer Correct ? | 16 Yes | 3 No |
Post New Answer View All Answers
What is externalizable interface?
How variables are stored in memory?
What is serialization in java?
What are the characteristics of Final,Finally and Finalize keywords.
How do you check if a character in a string is a digit or letter?
Is it possible to compare various strings with the help of == operator?
Can an interface have a class?
Define Multiprogramming and Multiprocessing in java.
What is native code?
What is difference between length and length() method in java ?
What is the purpose of abstract class?
What is join () in java?
Define an applet in java?
What is the difference between exception and error in java?
What is a "pure virtual" member function?