Is this constructor overloading ?<br /> <br /> What is the difference between the 2 methods in Java ?<br /> <br /> Class BuggyBread {<br /> <br /> BuggyBread(){<br /> }<br /> void BuggyBread(int x){<br /> }<br /> }
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

   



Interview Questions and Answers

 Q1. Is this constructor overloading ?

What is the difference between the 2 methods in Java ?

Class BuggyBread {

BuggyBread(){
}
void BuggyBread(int x){
}
}
Core Java
Ans. No, first method is a constructor whereas the second method is just a normal method. There is no way a constructor can be called explicitly and hence all explicit calls to BuggyBread() would result in compilation error.

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

   Like         Discuss         Correct / Improve     constructor  overloading


Related Questions

 Can we have more than two constructors in a class ?



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: