Constructors in Java- Type Overloading and examples
A Constructor in a special method that is used to initialize the object. Constructor name should be same as class name. Constructors does not have any return type.
1 2 3 4 5 6 | public class Student(){ //constructor Student(){ } } |
While creating object of above class we use
1 | Student student=new Studet() |
Here new is used to create object and after then the constructor Student() is get called it … Read more