求看一个代码练习题 编译不过
class StringTest4
{
public static void main(String[] args)
{
String s=" ab c ";
s=myTrim(s);
System.out.println("s="+s);
}
public static String myTrim(String s)
{
int start=0;
int end=s.length()-1;
while (start<=end && s.charAt(start)==' ')
{
start++;
}
while (start<=end &&s.charAt(end)==' ')
{
end--;
}
return s.substring(start,end+1);
}
}
编译不过咋回事?