总结:
package com.a.b;
//startWith().和endWith()是检查一个字符串是否以一个特定的字符序列开始或结束
public class Sdfs {
public static void main(String[] args) {
String t1 = "I like java";
String startStr = "I";
String endStr = "java";// 这里java是区分大小写的。所以字母全部一模一样
if (t1.startsWith(startStr))
System.out.println("t1 starts with startStr");
else
System.out.println("t1 DtOES not start with startStr");
if (t1.endsWith(endStr))
System.out.println("t1 ends with endStr");
else
System.out.println("t1 DOES NOT end with endStr");
}
}