Topic: sPara.length()和sPara.length有什么区别?

  Print this page

1.sPara.length()和sPara.length有什么区别? Copy to clipboard
Posted by: gumuyang
Posted on: 2007-02-13 11:53


public boolean isNumber(String sPara){
int iPLength = sPara.length();
for(int i=0;i<iPLength;i++){
char cTemp = sPara.charAt(i);
boolean bTemp = false;
for(int j=0;j<cNum.length;j++){
if(cTemp==cNum[j]){
bTemp = true;
break;
}
}
if(!bTemp) return false;
}
return true;
}

看了这段程序,忽然在想sPara.length()和sPara.length有什么区别?

另外谁能解释一下这段程序?感谢!

2.Re:sPara.length()和sPara.length有什么区别? [Re: gumuyang] Copy to clipboard
Posted by: why
Posted on: 2007-02-13 18:59

in sPara.length(), length() is a method of the String class
in cNum.length, length is an attribute of the array cNum (a special class that has unique syntax)

3.Re:sPara.length()和sPara.length有什么区别? [Re: gumuyang] Copy to clipboard
Posted by: gumuyang
Posted on: 2007-02-14 09:52

感谢楼上的回答!

不过我的英语水平很差,只能看懂SPara.length()是方法,cNum.length是长度,也不知道有没有理解对.


   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