您的位置:首页 > 其它

15-04-常用对象API(String类-常见功能-获取_2)

2015-08-10 22:49 363 查看
package cn.itcast.string.demo;

public class StringMethodDemo2 {

public static void main(String[] args)
{
/*
* 1.4获取字符串中的一部分字符串,也成为子串
* 		String substring(int beginIndex,int endIndex)//返回角标位置从beginIndex到endIndex-1的一个子串
* 		String substring(int beginIndex)//返回从beginIndex一直到最后的一个子串
*/

stringMethodDemo_2();
}

private static void stringMethodDemo_2()
{
String s = "abcdae";
System.out.println("substring:"+s.substring(2));
System.out.println("substring:"+s.substring(2,4));
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: