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
How do you reverse sort in java?
What are the supported platforms by java programming language?
Why are there no global variables in java?
What is a map in java?
What are the main differences between the java platform and other platforms?
How to Sort Strings which are given in List and display in ascending order without using java api.
Why is java called java?
What is udp in java?
What does indexof return in java?
how to create constants in java?
How many bytes are there?
What if I write static public void instead of public static void in java?
What is static class
What do the thread?class methods run() and start() do?
How do you remove duplicates from an array in java?