public class Test {
public static void main(String[] args) throws Exception {
String s1 = "/program/rest/user/forgotPwd/";
String s2 = "/program/rest/user/forgetPwd/test";
System.out.println(s1.startsWith(s2));
System.out.println(s2.startsWith(s1));
}
}
這兩種情況下打印false
。任何解釋?String java startsWith
forgotPwd <-> forgetPwd – 2012-01-03 12:14:34
forg'o'tPwd與forg'e'tPwd – A4L 2012-01-03 12:15:38
,請下次再仔細看... – m0skit0 2012-01-03 12:19:34