忽略内容,但下面是我的代码,我不断收到解析错误,但在我看来,我的所有括号都正确关闭,我一遍又一遍地查看它,也许我只是在这里吃火腿,任何帮助将不胜感激。
class java_ca
{
public static void main(String[] args);
char ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8, ans9, ans10, ans11, ans12;
int totaly, totaln;
{while ((ans1 != 'y') && (ans1 != 'n'))
{
System.out.println("1) Do You like Computers?");
ans1=Keyboard.readChar();
if(ans1=='y'){totaly++;}
else if(ans1=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans2=Keyboard.readChar();
if(ans2=='y'){totaly++;}
else if(ans2=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans3=Keyboard.readChar();
if(ans3=='y'){totaly++;}
else if(ans3=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans4=Keyboard.readChar();
if(ans4=='y'){totaly++;}
else if(ans4=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans5=Keyboard.readChar();
if(ans5=='y'){totaly++;}
else if(ans5=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans6=Keyboard.readChar();
if(ans6=='y'){totaly++;}
else if(ans6=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans7=Keyboard.readChar();
if(ans7=='y'){totaly++;}
else if(ans7=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like Computers?");
ans8=Keyboard.readChar();
if(ans8=='y'){totaly++;}
else if(ans8=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("1) Do You like to read?");
ans9=Keyboard.readChar();
if(ans9=='y'){totaly++;}
else if(ans9=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
{
System.out.println("10. Did you like this surevy?");
ans10=Keyboard.readChar();
if(ans10=='y'){totaly++;}
else if(ans1=='n'){totaln++;}
else{System.out.println("That is an invalid selection, please enter y or n to answer the questions");
}
}
}