Core Java - Interview Questions and Answers for 'Method overloading' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Method overloading' - 2 question(s) found - Order By Newest

Recently asked in Capital One.
 Q1. What will happen if we call perform(null) ?

public void perform(Object obj) {
System.out.println("Object");
}

public void perform(Integer int) {
System.out.println("Integer");
}
Core Java

Ans. compiler will throws error as ambiguous methods

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     overloading   method overloading     Asked in 1 Companies      intermediate


Related Questions

  Difference between Overloading and Overriding ?
  Can we overload main method in Java ?
  Can we overload constructors ?
 How is static and dynamic polymorphism achieved in Java ?
 Any real life example of Overloading and Overridding ?
 Does java supports operator overloading ?
 Can we overload abstract methods ?
 Which of the two - compile time and run time polymorphism - requires signature of the method to be different ?
 How does java identifies which method to be called in method overriding or runtime polymorphism, when both methods share the same name and signature ?


 Q2. in the following class:
class A {
void methoda(Object o) {
Sysout("Object");
}

void methoda(String s) {
Sysout("String");
}

public static void main(String []args) {
A a = new A();
a.methoda(null);
}
}

what will be printed?
Core Java2018-11-14 12:51:08

Ans. String

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Code  Coding  method overloading     Asked in 1 Companies


Related Questions

  Difference between Overloading and Overriding ?
  Can we overload main method in Java ?
  Can we overload constructors ?
 How is static and dynamic polymorphism achieved in Java ?
 What will happen if we call perform(null) ?

public void perform(Object obj) {
System.out.println("Object");
}

public void perform(Integer int) {
System.out.println("Integer");
}
 Any real life example of Overloading and Overridding ?
 Does java supports operator overloading ?
 Can we overload abstract methods ?
 Which of the two - compile time and run time polymorphism - requires signature of the method to be different ?
 How does java identifies which method to be called in method overriding or runtime polymorphism, when both methods share the same name and signature ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: