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

Is binary a low level language?

519


Is hashset ordered?

555


Can we create more than one object singleton class?

585


What are the benefits of operations?

516


What method is used to specify a container's layout in java programming?

549






what are abstract functions?

566


Is 0 an irrational number?

609


Can we override the overloaded method?

568


What is the independent variable in an experiment?

552


Which is better list or arraylist in java?

498


Explain illegalmonitorstateexception and when it will be thrown?

627


Whats the difference between notify() and notifyall()?

572


What are generic methods?

538


what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread

490


What is package protected in java?

528