- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_class2.java
More file actions
Latest commit
40 lines (24 loc) · 609 Bytes
/
Copy pathcustom_class2.java
File metadata and controls
40 lines (24 loc) · 609 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
classpen{
Stringpen;
Stringcolor;
Stringtype; //jel or ball pen
publicvoidwrite(){
System.out.println("write something");
}
publicvoidprintcolor() {
System.out.println(this.color);
}
}
publicclasscustom_class2 {
publicstaticvoidmain(String[] args) {
penpen1 = newpen();
pen1.color = "blue";
pen1.type = "jel";
pen1.write();
penpen2 = newpen();
pen2.color= "black";
pen2.type="ball pen";
pen1.printcolor();
pen2.printcolor();
}
}