Tag: constructor in java

Home constructor in java
How Constructor in JAVA works? Learn with a simple example
Post

How Constructor in JAVA works? Learn with a simple example

Constructor Special method to initialize the object When object of the class is created, constructor is called Can be used to set initial value of attribute in object Constructor is public But in java we can create public, private, protected constructor Private constructor : within a class   Example: public class ConstructorDemo {     int...