Core Java - Interview Questions and Answers for 'Constructor chaining' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Interview Questions


 2796 questions in repository.
 There are more than 200 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 'Constructor chaining' - 4 question(s) found - Order By Newest

 Q1. What are the common uses of "this" keyword in java ?Core Java
Anonymous
Ans. "this" keyword is a reference to the current object and can be used for following -

1. Passing itself to another method.

2. Referring to the instance variable when local variable has the same name.

3. Calling another constructor in constructor chaining.

  Sample Code for this keyword

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

   Like      Discuss      Correct / Improve     java   this   object reference   constructor chaining      intermediate        rare

Try 3 Question(s) Test


Related Questions

 What is the default value of a declared object reference ?
 Is it a bad practice to initialize object reference to Null ?
 How different is it when final applied to variables and object references ?
 In which memory segment - heap or stack, the following stored by JVM

1. static members
2. objects
3. object references
4. local or method variables



 Q2. Can we call constructor explicitly ?
Admin
info@buggybread.com
Ans. Yes.

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

   Like      Discuss      Correct / Improve     java   constructor   constructor chaining   oops   call constructor explicitly   yes-no

Try 1 Question(s) Test


Related Questions

  What is constructor chaining and how is it achieved in Java?


 Q3. What is constructor chaining and how is it achieved in Java?Core Java
Admin
info@buggybread.com
Ans. A child object constructor always first needs to construct its parent. In Java it is done via an implicit call to the no-args constructor as the first statement

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

   Like      Discuss      Correct / Improve     java   constructor   constructor chaining   oops   call constructor explicitly     Volante Technologies  Kellton Tech  SunGard

Try 2 Question(s) Test


Related Questions

  What are the common uses of "this" keyword in java ?
  Can we call constructor explicitly ?
  Which of the following is not the use of this keyword ?


 Q4. The following code is an example of

public class Car extends Vehicle{
   int x;

   Car(int y){
      x = 5;
   }

   Car(){
      this(5);
   }
}
Core Java
a. Constructor Overloading
b. Constructor Chaining
c. Both Constructor Overloading and Chaining
d. None of above

Ans.c. Both Constructor Overloading and Chaining



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: