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 is mean by exception?
Explain about complier design(phases)
What is a method in programming?
Which is better arraylist or vector?
What is arguments in java?
What are functions in java?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
What is a final class ?
what is the purpose of "virtual"?
What is meant by overloading?
What is the size of integer?
What is array pointers ?
What is a string what operation can be performed out with the help of a string?
What are the types of collections in java?
What is the flag in java?