-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
43 lines (36 loc) · 805 Bytes
/
Copy pathTest.java
File metadata and controls
43 lines (36 loc) · 805 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
class Main {
//Instance variables
private String msg;
private String secret = new String("secret");
private int msgCount = 1;
//Constructer
public Main(String msg){
this.msg = msg;
}
//Setters and Getters
public int getMsgCount(){
return msgCount;
}
public String getSecret(){
return secret;
}
public void setMsg(String msg){
this.msg = new String(msg+" Bro!");
addMsg();
}
//Brain Methods
public void addMsg(){
msgCount++;
}
public String toString(){
return msg;
}
public static void main(String[] args) {
Main hW = new Main("Hey Human");
System.out.println(hW);
System.out.println(hW.getMsgCount());
hW.setMsg("Hello");
System.out.println(hW);
System.out.println(hW.getMsgCount());
}
}