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


Please Help Members By Posting Answers For Below Questions

Why is singleton not thread safe?

654


What is the dot operator?

572


What is a boolean field?

531


What is singleton class in ruby?

564


Difference between operator overloading and function overloading

613






What is abstract class constructor called?

571


What does ide stand for?

523


Can you call a method in a method?

533


What are the differences between include directive and include action?

546


What is immutable class in java?

514


Is there any way to skip finally block of exception even if some exception occurs in the exception block?

600


What is meant by nested loop?

543


How many threads does a core java have?

512


What is a string token?

536


Explain about doubly linked list

621