-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaper.java
More file actions
52 lines (45 loc) · 1.16 KB
/
Copy pathPaper.java
File metadata and controls
52 lines (45 loc) · 1.16 KB
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
package lab5;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Paper extends Thing{
Method privateStringMethod;
public Paper (Wall Wall, String Name) {
Wall.Papers.add(this);
this.Name = Name;
try {
privateStringMethod = Thing.class.
getDeclaredMethod("Change", null);
privateStringMethod.setAccessible(true);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void Change(){
Thing lol = new Thing(){
@Override
void ChangeMood(Human Human) {
// TODO Auto-generated method stub
}
};
try {
privateStringMethod.invoke(lol);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
void ChangeMood(Human Human) {
// TODO Auto-generated method stub
}
}