Java 找出我在哪里错过了一个}
编译时,会出现以下错误:解析时到达文件末尾}^ 我知道我缺少了一个},我在末尾添加了一个,但仍然得到相同的编译错误..我的眼睛在看所有的}…任何有一双清晰眼睛的人都可以指出明显的错误 解决了…删除了代码没有}来结束swtichJava 找出我在哪里错过了一个},java,Java,编译时,会出现以下错误:解析时到达文件末尾}^ 我知道我缺少了一个},我在末尾添加了一个,但仍然得到相同的编译错误..我的眼睛在看所有的}…任何有一双清晰眼睛的人都可以指出明显的错误 解决了…删除了代码没有}来结束swtich 此代码的格式需要具有更好的一致性。使用,您可以自己找到此类问题的解决方案。在开关的末尾。默认值:break;}使用一个编辑器为你做这件事!Eclipse、Netbeans、Emacs等等。。。。你挑吧!看起来你忘了关上开关后的currly支架A{伙计-如果你按照惯例更好地
此代码的格式需要具有更好的一致性。使用,您可以自己找到此类问题的解决方案。在开关的末尾。默认值:break;}使用一个编辑器为你做这件事!Eclipse、Netbeans、Emacs等等。。。。你挑吧!看起来你忘了关上开关后的currly支架A{伙计-如果你按照惯例更好地缩进你的代码,你将能够更容易地看到。为什么是向下投票?教男人/女人如何钓鱼,不要整天分发鱼……这不是一半的问题评论所说的吗?在这里,我将用向上投票来平衡这一点。
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
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