os :windows7 x64
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)
code:
package jizuiku.t02; public class Demo02 { public static void main(String[] args) { String s1 = "World Hello"; String s2 = "hello"; String s3 = "Hello"; String s4 = "HellW"; System.out.println(s1.endsWith(s2)); System.out.println(s1.endsWith(s3));//"World Hello" 以 "Hello"作为结尾 System.out.println(s2.endsWith(s1)); System.out.println(s3.endsWith(s4)); } }
result:
Java优秀,值得学习。
学习资源:API手册+Java源码。
时间: 2024-11-05 13:46:58