It's not a secret anymore!
The moose likes Beginning Java and the fly likes why do the two errors come out? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why do the two errors come out? " Watch "why do the two errors come out? " New topic

why do the two errors come out?

li zhihui

Joined: Sep 29, 2004
Posts: 1
thanks for help me check the progarm:
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;

public class ItemDemo extends Applet implements ItemListener
TextArea area=new TextArea(6,30);
String Uni[]={"Tsinghua University","Perking University","Fudan University",
"Nankai University","Tianjin University"};
Checkbox cb[]=new Checkbox[5];
Checkbox radio[]=new Checkbox[5];

public void init()
add(new Label("This is a Item example"));
add(new Label("Please choose the University you like:"));
for (int i=0;i<5;i++);
cb[i]=new Checkbox(Uni[i]);

CheckboxGroup cbGroup=new CheckboxGroup();
add(new Label("please choose the University you like most:"));
for(int i=0;i<5;i++)
radio[i]=new Checkbox(Uni[i],cbGroup,false);

public void itemStateChanged(ItemEvent e)
area.append("you have chosen "+e.getItem()+"\n");

D:\JAVA\JCreator LE\MyProjects\ illegal start of expression
public void itemStateChanged(ItemEvent e)
D:\JAVA\JCreator LE\MyProjects\ ';' expected
2 errors
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi zhihui,

[ October 02, 2004: Message edited by: Joyce Lee ]
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi li,

Well.. those arn't the "real" errors.. you've put the } the wrong

Btw. you get 5 erros when you compile the above code.. happy hacking

/Svend Rost
I agree. Here's the link:
subject: why do the two errors come out?
It's not a secret anymore!