public class Test { public static void main(String[] args) { String txt = "Yuncode.net"; boolean a = txt.startsWith("Yun"); boolean b = txt.startsWith("yun"); // 区分大小写 System.out.println(a); System.out.println(b); } }