-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeStaticValue.java
More file actions
36 lines (26 loc) · 723 Bytes
/
ChangeStaticValue.java
File metadata and controls
36 lines (26 loc) · 723 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
package oop;
public class ChangeStaticValue {
int rollno;
String name;
private static String college = "TRICHANDRA";
public static void change(String collegeName) {
college = collegeName;
}
ChangeStaticValue(int rollno, String name) {
this.rollno = rollno;
this.name = name;
}
void display() {
System.out.println(rollno + " " + name + " " + college + "\n");
}
public static void main(String args[]) {
ChangeStaticValue s1 = new ChangeStaticValue(111, "Amrit");
s1.display();
ChangeStaticValue.college = "ASCOL";
ChangeStaticValue s2 = new ChangeStaticValue(222, "Devid");
ChangeStaticValue s3 = new ChangeStaticValue(333, "Lewis");
s1.display();
s2.display();
s3.display();
}
}