对
错
第1题:
有如下applet代码:
import java.applet.*;
import java.awt.*;
public class MyApplet extends Applet
{
AA s;
public void int()
{
s = new AA("Hello!", "I love JAVA.");
}
public void paint(Graphics g)
{
g.drawString(s.toString(), 30, 50);
}
}
class AA
{
String s1;
String s2;
AA(String str1, String str2)
{
s1 = str1;
s2 - str2;
}
public String toString()
{
return s1 + s2;
}
}
运行后,窗口上将会出现什么,选择一个正确答案______。
A.Hello!
B.I love JAVA.
C.Hello! I love JAVA.
D.什么都没有
第2题:
下列程序段: String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); 的结果为
A.false
B.true
C.1
D.0
第3题:
阅读下面程序 public class OperatorsAndExpressions{ void equalsMethodl(){ String s1=new String("how are you"); String s2=new String("how are you"); System.out.println(s1==s2); } public static void main(String args[]){ OperatorsAndExpressionsOperAndExp=new OperatorsAndExpressions(); //用于复合类型数据的“==”运算符 OperAndExp.equalsMethod1(); } } 程序运行结果是
A.=
B.true
C.false
D.equal
第4题:
下列代码的执行结果是( )。 public class Test{ public static void main String args[]){ String s1=new String("welcome"); String s2=new String("welcome"); System.out.println(s1==s2); System.out.println(s1.equals(s2)); } }
A.false,false
B.false,true
C.true,true
D.true,false
第5题:
下列语句输出结果为( )。 public class test { public static void main(StringArgsl[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); } }
A.false
B.true
C.1
D.0
第6题:
有如下代码段 public class OperatorAndExceptions { public static void main(String args[ ] { int i=10,j=15; System.out.println(i==j); String s1 = new String("how are you!"); String s2=new String("how are you!"); System.out.println(s1==s2); } } 其输出为( )。
A.true false
B.true true
C.false true
D.false false
第7题:
下列代码的执行结果是______。 public class ex55 { public static void main(String args[] ) { String s1=new String("hello"); String s2=new String("hello"); System.out.print (s1==s2); System.out.print (","); System.out.println (s1.equals (s2)); } }
A.true, false
B.true, true
C.false, true
D.false, false
第8题:
下面程序执行后,屏幕上显示的应是______。 public class Testl0 { public static void main(String[] args) { char char1[] = {'t', 'e', 's', 't'}; char char2[] = ('t', 'e', 's', 't', '1 }; String s1 = new String(char1); String s2 = new String(char2, 0, 4); System.out.println (si.equal (s2)); } }
A.true
B.假
C.test
D.编译错误
第9题:
Public class test ( Public static void stringReplace (String text) ( Text = text.replace (‘j’ , ‘i’); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args[]} ( String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printLn (textString + textBuffer); ) ) What is the output?()
第10题:
import java.util.*; public class WrappedString { private String s; public WrappedString(String s) { this.s = s; } public static void main(String[] args) { HashSet
第11题:
if(s==s2)
if(s.equals(s2))
if(s.equalsIgnoreCase(s2))
if(s.noCaseMatch(s2))
第12题:
The program prints “lava”
The program prints “java”
An error at line 7 causes compilation to fail.
Compilation succeeds but the program throws an exception.
第13题:
下列语句输出结果为( )。 public class test\ { public static void main (String args[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1.equals(s2))); } }
A.false
B.true
C.0
D.1
第14题:
下列程序的执行结果是______。 public class Test9 { public static void main(String[] args) { String s1 = new String("I am a girl"); String s2 = new String("I am a girl"); System.out.println (s1.equal (s2)); } }
A.true
B.假
C.I amgirl
D.都不正确
第15题:
下列程序的执行结果是 public class Testff{ public static void main(String args[]){ String sl=new String("I am boy"); String s2=new String("I am boy"); System.out.println(sl==s2); } }
A.真
B.假
C.I am boy
D.都不正确
第16题:
阅读下面程序 public class OperatorsAndExpressions { void equalsMethodl(){ String s1=new String("how are you"); String s2=new String("how are you"); System.out.println(s1==s2); } public static void main(String args[]){ OperatorsAndExpressions perAndExp=new OperatorsAndExpressions(); OperAndExp.equalsMethod1(); } } 程序运行结果是( )。
A. ==
B.true
C.假
D.equal
第17题:
下列代码段的执行结果是( )。 public class Test { public static void main(String args[ ]) { String s1= new String("hello"); String s2= new String("hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }
A.true false
B.true true
C.false true
D.false false
第18题:
下列语句输出结果为( )。public class test{public static void main(String args []){String s1=new String("How");String s2=new String("How");System.out.println(!(s1 ==s2));}
A.false
B.true
C.1
D.0
第19题:
下面程序执行后,屏幕上显示的应是( )。 public class Test{ public static void main(String[ ] args) { char ch1[]={'B','e','i','j','i','n','g'}; char ch2[]={'B','e','i','j','i','n','g','2','0','0','8'}; String s1 = new String(ch1); String s2 = new String(ch2, 0, 7); System.out.println(sl.equals(s2)); } }
A.true
B.false
C.Beijing
D.编译错误
第20题:
public class EqTest{() Public static void main(String args[]) EqTest e=new EqTest(); } EqTest(){ String s=”Java”; String s2=”java”; //在这儿放置测试代码 {Systrm.out.println(“相等”); Else{System.out.println(“不相等”)} } } 在上面的java代码的注释行位置,放置()测试代码能输出“相等”结果
第21题:
使用String s1=new String("Java");String s2=new String("Java")创建两个字符串时,s1,s2使用不同的内存空间
第22题:
0
1
2
3
4
Compilation fails.
An exception is thrown at runtime.
第23题: