Saturday, 14 September 2013

reached end of file while parsing but there is no missing brace

reached end of file while parsing but there is no missing brace

So when i compile this program java gives an error message :reached end of
file while parsing public class MohoscopeEngine implements
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;
}
}
i don't think i didn't enclose the class and i checked every bracket and
brace and found nothing wrong. Why did the problem occur and how should i
fix it?

No comments:

Post a Comment