java中subString()问题!
classCheckString{publicstaticvoidmain(String[]args){Stringstr="Nobadyeverwentbrokebyb...
class CheckString{
public static void main(String[] args){
String str="Nobady ever went broke by buying IBM";
System.out.println("The string is: "+str);
System.out.println("Length of this string is "+str.length());
System.out.println("The charactor at position 5: "+str.charAt(5));
System.out.println("The substring from 26 to 32: "+str.subString(26,32));
System.out.println("The index of charactor v:"+str.indexOf('v'));
System.out.println("The index of the beginning of the substring \"IBM\":"+str.indexOf("IBM"));
;
System.out.println("The string upper case:"+str.toUpperCase());
}
}
编译发生错误:
CheckString.java:8: cannot resolve symbol
symbol : method subString (int,int)
location: class java.lang.String
System.out.println("The charactor at position 5: "+str.subString
(26,32));
^
1 error 展开
public static void main(String[] args){
String str="Nobady ever went broke by buying IBM";
System.out.println("The string is: "+str);
System.out.println("Length of this string is "+str.length());
System.out.println("The charactor at position 5: "+str.charAt(5));
System.out.println("The substring from 26 to 32: "+str.subString(26,32));
System.out.println("The index of charactor v:"+str.indexOf('v'));
System.out.println("The index of the beginning of the substring \"IBM\":"+str.indexOf("IBM"));
;
System.out.println("The string upper case:"+str.toUpperCase());
}
}
编译发生错误:
CheckString.java:8: cannot resolve symbol
symbol : method subString (int,int)
location: class java.lang.String
System.out.println("The charactor at position 5: "+str.subString
(26,32));
^
1 error 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询