The following program is Overloading or Overriding?
public class PolymorphismEx {
public int sampleMethod(int a) {
return a;
}
public String sampleMethod(int a) {
return "Is it Overloading or Overriding???";
}
}
Answer Posted / kvsravindrareddy
Its kind of overriding, but the program will give compilation
error. why because Overriding cannot be possible within the
same class. or Duplicate method cannot possible within the
same class.
| Is This Answer Correct ? | 13 Yes | 5 No |
Post New Answer View All Answers
Name component subclasses that support painting in java programming?
How many types of equations are there?
Why hashmap is used in java?
What's the difference between an abstract class and interface in java?
What are the types of literals?
Can we convert list to set in java?
What is multi level inheritance in java?
How does a for loop work?
What is default switch case? Give example.
What is methods in java?
What does arrays sort do in java?
Why are constructors used?
Explain the differences between abstraction and encapsulation?
What is floor math?
what is predefined function in java?