-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConstOver.java
More file actions
28 lines (25 loc) · 852 Bytes
/
ConstOver.java
File metadata and controls
28 lines (25 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//Author : Deepansh Dubey.
//Date : 14/09/2021.
class ConstOver
{
int id;
String name;
ConstOver()
{
System.out.println("this a default constructor");
}
ConstOver(int i, String n)
{
id = i;
name = n;
}
public static void main(String[] args)
{
ConstOver ob = new ConstOver();
System.out.println("\nDefault Constructor values: \n");
System.out.println("Student Id : "+ob.id + "\nStudent Name : "+ob.name);
System.out.println("\nParameterized Constructor values: \n");
ConstOver student = new ConstOver(2, "Robin");
System.out.println("Student Id : "+student.id + "\nStudent Name : "+student.name);
}
}