A special method used to initialise objects. Constructor is a block of code similar to method Constructor is called when an object of a class is created All Classes have constructors by 'default' Java (JDK) creates a Class Constructor ,you need not to create a Class constructor Accept parameters to initialise Object properties It is used to set default or user-defined values for the object's attributes Initialise objects at the time of object creation. Constructor Syntax class ClassName { // Con
Comment
Sign in to join the discussion.
Loading comments…