Topic: 感觉很正确的程序,怎么会有错误?

  Print this page

1.感觉很正确的程序,怎么会有错误? Copy to clipboard
Posted by: yangzhen1983
Posted on: 2005-10-20 00:48

class B{
BitSet bs=new BitSet(366);
int [] ho ={12,45,56,58,89,94,288,350};
  for(int i=0;i<ho.ength;i++) //错误信息
   {
bs.set(ho[i]);
   }
} //错误信息

请大家指教 错在那里?

2.Re:感觉很正确的程序,怎么会有错误? [Re: yangzhen1983] Copy to clipboard
Posted by: yangzhen1983
Posted on: 2005-10-20 01:18

class B{
BitSet bs=new BitSet(366);
int [] ho ={12,45,56,58,89,94,288,350};
for(int i=0;i<ho.length;i++) //错误信息
{
bs.set(ho[i]);
}
} //错误信息
不是ho.length的问题,第一次我发少了一个l,但是加上了还是有错误的 帮忙指正

3.Re:感觉很正确的程序,怎么会有错误? [Re: yangzhen1983] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-10-20 01:37

What is your 错误信息???

Also, you need to put the entire code here to help people to help you!!!

Please don't put your 感觉 here. Your 感觉 means nothing!!!

4.Re:感觉很正确的程序,怎么会有错误? [Re: yangzhen1983] Copy to clipboard
Posted by: JavaandC
Posted on: 2005-10-20 08:42

你认为可以在class类里面直接写Java语句吗?你还是好好看看书,你的基础太差了。你的程序应该这样写:

class B{
  int [] ho =new int[]{12,45,56,58,89,94,288,350};
  BitSet bs=new BitSet(366);

  public void a()
  {
    for(int i=0;i<ho.length;i++)
    {
      bs.set(ho[i]);
    }
  }
}

5.Re:感觉很正确的程序,怎么会有错误? [Re: yangzhen1983] Copy to clipboard
Posted by: yangzhen1983
Posted on: 2005-10-20 09:06

谢谢两位的教诲,小弟的确是基础太查了,我也好好的看了2遍书了,但是动手能力太差了,这个小小的错误我找了一个晚上也没找到,没办法才向大家请教的,谢谢!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923