volatile 变量可见
public class RollCall{
private static String rollCall;
private static volatile String answer;
private static volatile boolean isClassStart = false;
static class Person {
protected String name;
public String say(String word) {
return word;
}
public boolean listen(String word) {
if (word != null && word.contains(name)) {
return true;
}
return false;
}
}
static class Teacher extends Person {
List<Student> students;
public boolean rollCall() {
System.out.println("开始点名!");
int waitTime = 5;
int haveWait = 0;
int count = 0;
for (int i = 0; i < students.size(); i++) {
rollCall = say(students.get(i).name);
System.out.println(name + "老师说:" + rollCall + "来了没!!!!");
while