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 java regex?
What is numel matlab?
What is int short for?
What is super in java?
How to access arraylist elements in java?
What’s the difference between constructors and other methods?
When is update method called?
What is the format specifier?
What is application system?
Can memory leak in java?
Is string is a data type in java?
Why javac is not recognized?
Can we have any code between try and catch blocks?
What makes a function well defined?
What is udp in java?