-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest6.java
More file actions
50 lines (45 loc) · 937 Bytes
/
Copy pathTest6.java
File metadata and controls
50 lines (45 loc) · 937 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
/*Practical JavaFullStack Course
* Name: Abhay Vijayrao Gadge
* Batch No:J150
*/
// data hiding
package practisetest;
class Student{
int roll;
String name;
int marks;
public void setRoll(int roll){
// if(userIsValid() & isRollValid()){
this.roll = roll;
//}
}
public void setName(String name){
this.name = name;
}
public void setMarks(int marks){
// if(userIsValid() & isMarksValid()){
this.marks = marks;
//}
}
public int getRoll(){
return this.roll;
}
public String getName(){
return this.name;
}
public int getMarks(){
return this.marks;
}
}
public class Test6{
public static void main(String args[]){
System.out.println("Hello, World!");
Student s1 = new Student();
s1.setRoll(3);
s1.setName("Omkar");
s1.setMarks(110);
System.out.println("roll = "+s1.getRoll());
System.out.println("name = "+s1.getName());
System.out.println("marks = "+s1.getMarks());
}
}