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 does || mean in vectors?
Why do we need strings in java?
How can we make copy of a java object?
What is string pool?
Explain the difference between runnable and callable interface in java?
How to declare an arraylist in java?
what is difference betweem home interface and remote interface?
What is a variable and constant?
What is deserialization?
Which programming language is most secure?
How we can generate random numbers in java?
What is the collections api?
What is get () in java?
What two classes are used to read data only?
In the below example, how many string objects are created?