当我编译时,我得到这个错误:解析时到达文件结尾 }^ 我知道我错过了一个 },我在最后添加了一个但仍然得到相同的编译错误..我的眼睛都在交叉看 }。 ..任何有一双清澈眼睛的人都能指出明显的东西吗?
解决了...删除了代码
当我编译时,我得到这个错误:解析时到达文件结尾 }^ 我知道我错过了一个 },我在最后添加了一个但仍然得到相同的编译错误..我的眼睛都在交叉看 }。 ..任何有一双清澈眼睛的人都能指出明显的东西吗?
解决了...删除了代码
此代码需要以更好的一致性进行格式化。使用IDE,您可以自己找到此类问题的解决方案。
没有}
结束swtich
default:
break;
}
c++;
System.out.print( "\n\t\t\tEnter Another Pledge? (Y/N)?\n\t\t\t" );
a = Keyboard.nextLine();
import java.util.Scanner;
import java.text.*;
public class test2
{
public static void main(String[] args)
{
final int Max = 50;
int c = 0;
int s = 0;
int number =0;
String a;
char choice, summary;
Student [] jogathon = new Student[Max];
Scanner Keyboard = new Scanner(System.in);
for (int i=0; i< Max; i++) {
jogathon[i].laps = 0;
jogathon[i].amount = 0;
jogathon[i].totals = 0;
} // make it more visible to relieve yoursel of this problem
do
{ // next time put tabs after here
Student.opening();
System.out.print( "\n\t\tIs this a Donation? (y/n)?\n\t\t" );
a = Keyboard.nextLine();
choice = a.charAt(0);
switch(a)
{ // what an ugly way to format a switch statement...
case 'n':
case 'N':
jogathon[c].getdata();
s = jogathon[c].number;
if (s >= 1 && s <= 7)
{
jogathon[c].gettotals();
jogathon[c].toString();
jogathon[c].showTotals();
}
break;
case 'y':
case 'Y':
jogathon[c].number = 0;
jogathon[c].gettotals();
jogathon[c].toString();
jogathon[c].showTotals();
break;
default:
break;
} // look you forgot the } here at the end of the switch statement
c++;
System.out.print( "\n\t\t\tEnter Another Pledge? (Y/N)?\n\t\t\t" );
a = Keyboard.nextLine();
choice = a.charAt(0);
choice = Character.toUpperCase(choice);
// this one below goes to the end of the "do{"
} while (((a == 'Y') || (a == 'y')) && (c > Max));
for (int i=0; i< c; i++) {
System.out.println(i + "\t" + jogathon[i].name + "\t" + >money.format(jogathon[i].pledge));
}
System.out.println( "===============================\n");
for (int i=0; i< 7; i++) {
System.out.println(jogathon[c].names[i] + "\t" + > >money.format(jogathon[c].totals[i]));
}
// missing your final }'s here I think maybe you just omitted the rest