File: A.java

package info (click to toggle)
eclipse-jdt-ui 4.26-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,204 kB
  • sloc: java: 816,341; xml: 14,255; jsp: 33; makefile: 5
file content (21 lines) | stat: -rw-r--r-- 331 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package p;

enum A {
    RED, GREEN, BLUE, YELLOW;
    A buddy;
    public A getBuddy() {
        return buddy;
    }
    public void setBuddy(A b) {
        buddy= b;
    }
}

class User {
    void m() {
        A.RED.setBuddy(A.GREEN);
        if (A.RED.getBuddy() == A.GREEN) {
            A.GREEN.buddy= null;
        }
    }
}