File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Associate Certification (OCAJP 7) and the fly likes Verification of constructor calling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "Verification of constructor calling" Watch "Verification of constructor calling" New topic
Author

Verification of constructor calling

Glenn Gould
Greenhorn

Joined: Jul 09, 2013
Posts: 5
Verification of constructor calling
1) From within the same class
When you are within the same class, one constructor can call another constructor using the "this" keyword


2) Within a class hierarchy
When there is an inheritance hierarchy, the constructor of the subclass can call the constructor of the superclass using the "super" keyword


Please confirm.
Mala Gupta
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 245
    
    9
Glenn,

Verification of constructor calling
1) From within the same class
When you are within the same class, one constructor can call another constructor using the "this" keyword

2) Within a class hierarchy
When there is an inheritance hierarchy, the constructor of the subclass can call the constructor of the superclass using the "super" keyword
Please confirm.



Both of your statements are correct - as already confirmed by the code output.

With respect,
Mala




Author of Manning's OCA Java SE 7 Programmer I Certification Guide and OCP Java SE 7 Programmer II Certification Guide
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Verification of constructor calling
 
Similar Threads
Constructor of a parent class
Constructors
Let's have a look!
why am i able to call a static method using an object of that class ...
Java class Super()??