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
How will you reverse a singly-link list?
What is class forname used for?
What do you know about the garbate collector?
Explain access modifiers in java.
What are register variables what are the advantages?
Explain an algorithm to find depth of a binary tree.
What is java regex?
What is math floor in java?
What is the meaning of variables in research?
Explain inner classes ?
What is style and indentation?
What is java argument list?
What makes a function well defined?
What are static methods?
What do you mean by local class?