62,614
社区成员
发帖
与我相关
我的任务
分享
false
312017024
1094643840
true
-540425984
-540425984
public class T6 {
public static void main(String[] args) {
String s = "aaaaaaaa";
String b = "bbbbbbbb";
// s = s.toUpperCase();
b = b.toUpperCase();
System.out.println(s == s.toUpperCase());
System.out.println(s.hashCode());
System.out.println(s.toUpperCase().hashCode());
System.out.println();
System.out.println(b == b.toUpperCase());
System.out.println(b.hashCode());
System.out.println(b.toUpperCase().hashCode());
}
}
public class T4 {
public static void main(String[] args) {
String s = "Freddd";
System.out.println(s);
System.out.println(s==(s + "47"));
System.out.println(s == s.substring(2, 5));
System.out.println(s == s.toUpperCase());
s.toString(); //No
}
}
public String substring(int beginIndex, int endIndex) {
if (beginIndex < 0) {
throw new StringIndexOutOfBoundsException(beginIndex);
}
if (endIndex > count) {
throw new StringIndexOutOfBoundsException(endIndex);
}
if (beginIndex > endIndex) {
throw new StringIndexOutOfBoundsException(endIndex - beginIndex);
}
return ((beginIndex == 0) && (endIndex == count)) ? this :
new String(offset + beginIndex, endIndex - beginIndex, value);
}
public class T4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s = "aaaaaaaa";
// s = s.substring(2, 5);
// s = s.toUpperCase();
s.toString();
System.out.println(s == s+"jj");
System.out.println(s == s.substring(2, 5));
System.out.println(s == s.toUpperCase());
}
}
public class T4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s = "aaaaaaaa";
s = s + "88";
// s = s.substring(2, 5);
s = s.toUpperCase();
s.toString();
System.out.println(s);
System.out.println(s == s.substring(2, 5));
System.out.println(s == s.toUpperCase());
}
}
AAAAAAAA88
false
true