下列代码段执行后的结果是
StringBuffer s=new StringBuffer("Hello");
if((s.length()>=5)&&(s.append("there").equals("False")))
s.replace(0,6,"False");
System.out.println(s);
StringBuffer s=new StringBuffer("Hello");
if((s.length()>=5)&&(s.append("there").equals("False")))
s.replace(0,6,"False");
System.out.println(s);
举一反三
- 设有如下代码段 1 String s = null; 2 if ( s != null & s.length() > 0) 3 System.out.println("s != null & s.length() > 0"); 4 if ( s != null && s.length() > 0) 5 System.out.println("s != null & s.length() > 0"); 6 if ( s != null || s.length() > 0) 7 System.out.
- 设有如下代码段 1 String s = null; 2 if ( s != null & s.length() > 0) 3 System.out.println("s != null & s.length() > 0"); 4 if ( s != null && s.length() > 0) 5 System.out.println("s != null & s.length() > 0"); 6 if ( s != null || s.length() > 0) 7 System.out.println("s != null & s.length() > 0"); 8 if ( s != null | s.length() > 0) 9 System.out.println("s != null | s.length() > 0"); 哪些行将抛出空指针异常?
- 执行StringBuffer s = new StringBuffer("abc"); s.insert(1,"Good"); s的正确结果是()
- 请说出下列代码的执行结果 : String s = "abcd"; String s1 = new String(s); if (s = = s1) System.out.println("the same"); if (s.equals(s1)) System.out.println("equals");
- 下面代码的输出结果是0。 String s = new String(); System.out.println(s.length());