Constructor in Java
java
dev.to
What is Constructor? A constructor in Java is a special method used to initialize objects when they are created. A constructor must have the exact same name as the class. A constructor does not return any value, not even void Types of Constructor Default Constructor A default constructor is a constructor with no parameters. Example: public class Student{ String name; int age; // Default Constructor public Student(){ System.out.println("Default constructor