if问题
public final void jibieff(){
if(no3 <100);
no1=1;
jibie.setText( "级别数: "+no1);
if(no3> 100&no3 <200);
no1=2;
jibie.setText( "级别数: "+no1);
if(no3> 200);
no1=3;
jibie.setText( "级别数: "+no1);
}
shi.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
no3++;
jibieff();
jibie.setText( "级别数: "+no1);
fenshu.setText( "分数: "+no3);
}
});
为什么返回值是3 呢?
加了return;第1个 return 下面的代码就变成 不可达代码 .
请问怎么改啊?
------解决方案--------------------if后面的{}呢~~~~~~~~~~~~
------解决方案--------------------public final void jibieff(){
if(no3 <100){
no1=1;
jibie.setText( "级别数: "+no1);}
if(no3> 100&no3 <200){
no1=2;
jibie.setText( "级别数: "+no1);}
if(no3> 200){
no1=3;
jibie.setText( "级别数: "+no1);}
}
shi.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
no3++;
jibieff();