Constructors and Instantiation
There are basically two types: Predefined types and Custom Type
Predefined types
It is the blueprint. It can be instantiated simply by using a literal such as 12 or “Hello world”. They are the types which are supported by the compiler. Examples such as int – represent a set of integers and perform arithmetic functions.
Custom Type
New operator creates instances of custom type. After instantiation the constructor is called to perform initialization.
Constructor
Defined like method but method name is the name of the class.
public class UnitConverter { public UnitConverter (int unitRatio) { ratio = unitRatio;} }