如题
public class Test
{
public static void main(String[] args)
{
String greeting = "abcd";
boolean x = greeting.endWith("cd");
System.out.println(x);
}
}
出现这样的结果

------解决方案--------------------
endWith 少了个s 应为endsWith
public class Test
{
public static void main(String[] args)
{
String greeting = "abcd";
boolean x = greeting.endWith("cd");
System.out.println(x);
}
}