-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample5.java
More file actions
54 lines (52 loc) · 883 Bytes
/
Example5.java
File metadata and controls
54 lines (52 loc) · 883 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package Encapsulation;
class student1
{
private int id;
private int rollno;
private String name;
private double marks;
public int getID()
{
return id;
}
public void setID(int id)
{
this.id = id;
}
public int getROLLNO()
{
return rollno;
}
public void SetROLLNO(int rollno)
{
this.rollno = rollno;
}
public String getNAME()
{
return name;
}
public void setNAME(String name)
{
this.name = name;
}
public double getMARKS()
{
return marks;
}
public void setMARKS(double marks)
{
this.marks = marks;
}
}
public class Example5
{
public static void main(String[]args)
{
student1 S = new student1();
S.setID(101);
S.setMARKS(90);
S.setNAME("RAj");
S.SetROLLNO(221);
System.out.println(S.getID()+" "+S.getMARKS()+" "+S.getNAME()+" "+S.getROLLNO());
}
}