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
Is empty string in java?
What are the main uses of java?
What is the difference between an if statement and a switch statement?
What is an argument java?
What does the exclamation mark mean in java?
Why stringbuilder is not thread safe?
What is a nullable field?
What is functional interface in java example?
What is the difference between object oriented programming language and object based programming language?
What is udp in java?
Explain the inheritance?
What is palindrome in java?
What is jagged array in java?
Give me example of derived data types.
What is the declaration statement?