Embed presentation
Downloaded 26 times

![}
}
classConstructorOverLoad
{
public static void main(String arg[])
{
Student s1 = new Student(7448264,"Ultimate Virus");
s1.displayStudent();
Student s2 = new Student();
s2.displayStudent();
}
}](https://image.slidesharecdn.com/constructor-131127074455-phpapp02/75/Constructor-Overloading-in-java-2-2048.jpg)


This document demonstrates constructor overloading in Java by defining two constructors for a Student class - a default constructor that sets default values for roll number and name, and a parameterized constructor that accepts and assigns values for roll number and name. The main method creates two Student objects, one using each constructor, and calls the displayStudent method to output the roll number and name for each student.

![}
}
classConstructorOverLoad
{
public static void main(String arg[])
{
Student s1 = new Student(7448264,"Ultimate Virus");
s1.displayStudent();
Student s2 = new Student();
s2.displayStudent();
}
}](https://image.slidesharecdn.com/constructor-131127074455-phpapp02/75/Constructor-Overloading-in-java-2-2048.jpg)
