forked from joharbatta/DataStructure-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor.java
More file actions
37 lines (33 loc) · 626 Bytes
/
constructor.java
File metadata and controls
37 lines (33 loc) · 626 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
28
29
30
31
32
33
34
35
36
class Student{
private int id1;
private String name;
public Student(int id,String name)
{
id1=id;
this.name=name;
}
public void setId(int id)
{
id1=id;
}
public int getId()
{
return this.id1;
}
public void setname(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
}
public class constructor{
public static void main(String args[])
{
Student obj=new Student(101,"abc");
System.out.println(obj.getId());
System.out.println(obj.getName());
}
}