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
Write code of any action class?
What does singleton mean in java?
Why main method is static in java?
Is call by reference possible in java?
What is anti pattern in cyber security?
What are the skills required for core java?
Can vector have duplicates in java?
What is byte value?
Why are variables important in research?
What are constants?
How do I run java on windows?
What is independent and dependent variables in research?
What is locale in java?
Can we use a default constructor of a class even if an explicit constructor is defined?
How do you write a good declaration?