大家好!不好意思我是初学者,刚刚开始学习java不久。我调试示例程序的时候出现的错误,源代码是import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
class EWindow extends Frame implements ActionListener, ItemListener
{
String str[]=new String[7];String s;
FileReader file;
BufferedReader in;
Button start,next;
Checkbox box[];
TextField problem,scorevalue;
int score=0;
CheckboxGroup age=new CheckboxGroup();
EWindow()
{
super("testing");
scorevalue=new TextField(10);
problem=new TextField(70);
start=new Button("restart");
start.addActionListener(this);
next=new Button("nextone");
next.addActionListener(this);
box=new Checkbox[4];
for(int i=0;i<=3;i++)
{
box[i]=new Checkbox("",false,age);
box[i].addItemListener(this);
}
try {
file=new FileReader("test.txt");
in=new BufferedReader(file);
}
catch(IOException e){}
setBounds(100,100,400,320);setVisible(true);
setLayout(new GridLayout(4,1));
setBackground(Color.pink);
Panel p1=new Panel(),p2=new Panel(),
p3=new Panel(),p4=new Panel(),p5=new Panel();
p1.add(new Label("problem:"));p1.add(problem);
p2.add(new Label("choose:"));
for(int i=0;i<=3;i++)
{
p2.add(box[i]);
}
p3.add(new Label("your score:"));p1.add(scorevalue);
p1.add(start);p1.add(next);
add(p1);add(p2);add(p3);add(p4);
addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
reading();
}

public void reading()
{
int i=0;
try {
s=in.readLine();
if(!(s.startsWith("endedn")))
{
StringTokenizer tokenizer = new StringTokenizer(s,"#");
while(tokenizer.hasMoreTokens())
{
str[i]=tokenizer.nextToken();
i++;
}
problem.setText(str[0]);
for(int j=1;j<=4;j++)
{
box[j-1].setLabel(str[j]);
}
}
else if(s.startsWith("endend"))
{
problem.setText("finish");
for(int j=0;j<4;j++)
{
box[j].setLabel("end");
in.close();
file.close();
}
}
}
catch(Exception exp){problem.setText("nofile");}
}

public void actionPerformed(ActionEvent event)
{
if(event.getSource()==start)
{
score=0;
scorevalue.setText("re: "+score);
try {
file=new FileReader("test.txt");
in=new BufferedReader(file);
}
catch(IOException e){}
reading();
}
if(event.getSource()==next)
{
reading();
for(int j=0;j<4;j++)
{
box[j].setEnabled(true);
}
}
}

public void itemStateChangeed(ItemEvent e)
{
for(int j=0;j<4;j++)
{
if(box[j].getLabel().equals(str[5])&&box[j].getState())
{
score++;
scorevalue.setText("re: "+score );
}
box[j].setEnabled(false);
}
}
}
public class test
{
public static void main(String args[]) {
EWindow w=new EWindow();
w.pack();
} }