首页上一页 1 下一页尾页 1 条记录 1/1页
java从入门到精通第五章例题
发表在Java图书答疑
2014-03-11
是否精华
是
否
版块置顶:
是
否
public class Subs { // 创建类
public static void main(String args[]) { // 主方法
String str = "hello word"; // 定义的字符串
String substr = str.substring(0, 3); // 对字符串进行截取
System.out.println(substr); // 输出截取后的字符串
}
}
上面的程序输出的是hel,hello word
0123456789这样看的话应该是输出hell的啊,为是么不是输出hell呢
public static void main(String args[]) { // 主方法
String str = "hello word"; // 定义的字符串
String substr = str.substring(0, 3); // 对字符串进行截取
System.out.println(substr); // 输出截取后的字符串
}
}
上面的程序输出的是hel,hello word
0123456789这样看的话应该是输出hell的啊,为是么不是输出hell呢