Credits

Sunday, July 4, 2010

Java Certification Exam Tips on Constructors

Java Certification Exam is given to Java programmers to earn a professional JAVA certified recognition. I found this tips from this Java Exam Tips portal.

The JVM does not call an object’s constructor when an object is cloned.
Constructors never return a value. If you do specify a return value, the JVM will interpret your intended constructor as a method.
If a class contains no constructor declarations, then a default constructor that takes no arguments is supplied. This default constructor invokes the no-args superclass constructor, i.e. calls super();
If, in a constructor, you do not make a direct call to super or this (with or without args) [note: must be on the first line] then super(no args) will first be invoked then any code in the constructor will be executed. See constructors.jpr project.
A call to this in a constructor must also be on the first line. Note: can’t have an explicit call to super followed by a call to this in a constructor - only one direct call to another constructor is allowed.

AddThis