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
what happens when a thread cannot acquire a lock on an object? : Java thread
Can we overload final method in java?
What is anti pattern in cyber security?
Why declare Main() method as a static in java ?
What is set string?
Write code of any action class?
What will happen if static modifier is removed from the signature of the main method?
Does a class inherit the constructors of its superclass in java programming?
What is the locale class in java programming?
What is java ceil?
What is a functional interface?
What about features of local inner class?
What is the program compilation process?
Which sorting is best in java?
How do you use find and replace?