所以当我编译这个程序时,java给出了一个错误消息:在解析公共类MohoscopeEngine实现HoroscopeEngine时到达文件末尾{ ^
//MohoscopeEngine.java
public class MohoscopeEngine implements HoroscopeEngine{
final String[] constant ={"Bring your friends from ", "and ", "to go to party at "};
String[] fiveplaces = {"Rocky", "Safford", "Chapin", "Art Museum", "Mead"};
/** generate random index for array without repeating*/
public String randomIndex(){
int index = (int)(Math.floor(Math.random()*5));
return fiveplaces[index];
}
public String getHoroscope(){
//for(int i =0; i < index.length; i++)
String mohoscope = constant[0] + randomIndex() + constant[1] + randomIndex() + constant[2] + randomIndex();
return mohoscope;
}
}
我不认为我没有附上班级,我检查了每个支架和大括号,没有发现任何问题。为什么会出现问题,我应该如何解决?