Constructor in java : >A constructor is a special member method which will be called by the jvm automatically(implicitly) whenever an object is created for placing placing our own values instead of placing default values. PURPOSE: *the purpose of constructor concept is initialize an object. *Advantages of constructor: 1.constructor Eliminates default values . 2.constructor eliminates in calling the ordinary method explicitly. *Rules/properties of constructor: 1.constructor will be called automatically by the jvm whenever an object is created. 2.the name of constructor must be similar to class name. 3.constructor should not return an return type,even void also.(if we write any return type then it will be treated as ordinary method). 4.constructor modifier should not be static because constructor will be called each and every time whenever an object is created .java does not contain static constructors. 5.constructor will not be participated i...
The best way to learn Java programming is by practicing examples. The page contains examples on basic concepts of Java. You are advised to take the references from these examples and try them on your own.