This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do the two errors come out?

 
li zhihui
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi zhihui,



Joyce
[ October 02, 2004: Message edited by: Joyce Lee ]
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic