aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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
Author

why do the two errors come out?

li zhihui
Greenhorn

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(area);
add(new Label("Please choose the University you like:"));
for (int i=0;i<5;i++);
{
cb[i]=new Checkbox(Uni[i]);
add(cb[i]);
cb[i].addItemListener(this);
}

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);
add(radio[i]);
radio[i].addTtemListener(this);
}

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



D:\JAVA\JCreator LE\MyProjects\ItemDemo.java:34: illegal start of expression
public void itemStateChanged(ItemEvent e)
^
D:\JAVA\JCreator LE\MyProjects\ItemDemo.java:38: ';' expected
};
^
2 errors
Joyce Lee
Ranch Hand

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



Joyce
[ 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
place.


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

/Svend Rost
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do the two errors come out?