public class SortItem
extends java.applet.Applet
implements Runnable, MouseListener {
private Thread kicker;
...
SortAlgorithm algorithm; //问题在这里
....
}
class SortAlgorithm {
private SortItem parent; //这里也出问题 protected boolean stopRequested = false; public void init() {
stopRequested = false;
}
public void setParent(SortItem p) {
parent = p;
}
public void stop() {
stopRequested = true;
}
。
}
extends java.applet.Applet
implements Runnable, MouseListener {
private Thread kicker;
...
SortAlgorithm algorithm; //问题在这里
....
}
class SortAlgorithm {
private SortItem parent; //这里也出问题 protected boolean stopRequested = false; public void init() {
stopRequested = false;
}
public void setParent(SortItem p) {
parent = p;
}
public void stop() {
stopRequested = true;
}
。
}
extends java.applet.Applet
implements Runnable, MouseListener {
private Thread kicker;
...
SortAlgorithm algorithm; ----//问题在这里
....
//}//这个大括号不要,在SortAlgorithm的后边添一个};//这里SortAlgorithm已经定义为SortItem的内部类,他可以使用SortItem的任意成员。
class SortAlgorithm {
//private SortItem parent; //这里也出问题//不要了。
protected boolean stopRequested = false; public void init() {
stopRequested = false;
}
public void setParent(SortItem p) {
parent = p;
}
public void stop() {
stopRequested = true;
}
。
}
}//新添括号。
或者
javac -classpath . SortItem.java
javac -classpath . SortAlgorithm.java