单选题 public class Test { public static void main(String args[]){ EqTest e = new EqTest(); e.show();}} class EqTest{ String s = "Java"; String s2 = "java"; public void show(){ //在这儿放置测试代码 {System.out.println("相等");} else {System.out.println("不相等");} }} 在上面的Java代码的注释行位置,放置()测试代码能输出“相等”结果(选一项)

A、 if(s==s2)
B、 if(s.equals(s2))
C、 if(s.equalsIgnoreCase(s2))
D、 if(s.noCaseMatch(s2))
下载APP答题
由4l***cq提供 分享 举报 纠错

相关试题

单选题 给定一个Java程序的代码片断如下,运行后,正确的输出结果是(选一项) String s="hello,world"; s.replace(","," "); System.out.println(s);

A、hello world;
B、hello, world
C、HELLO WORLD;
D、HELLO ,WORLD;

单选题 给定某Java程序的main方法如下,该程序编译运行的结果是(选一项) public static void main(String[]args){ String str = null; str.concat("abc"); str.concat("def"); System.out.println(str); }

A、null
B、abcdef
C、编译错误
D、运行时出现异常

单选题 给定java代码如下,d的取值范围是(选一项) double d = Math.random();

A、d>=1.0
B、d>=0.0,并且d<1.0
C、d>=0.0,并且d<Double.MAX_VALUE
D、d>=1.0,并且d<Double.MAX_VALUE

单选题 java语言中,下列处理输出操作的所有类的基础的是(选一项)

A、DataOutput
B、OutputStream
C、BufferedOutputStream
D、IOStream

单选题 Java中,使用()修饰符时,一个类能被同一包或不同包中的其他类访问(选一项)

A、private
B、protected
C、public
D、friendly

单选题 给定java代码,如下:运行时,会产生()类型的异常(选一项) String s = null; s.concat("abc");

A、AritthmeticException
B、NullpointerException
C、IOException
D、EOFException

单选题 给定如下JAVA 程序片断: class A{ public A(){ System.out.println("A"); } } class B extends A{ public B(){ System.out.println("B"); } public static void main(String[] args){ B b = new B(); } } 上述程序将(选一项)

A、不能通过编译
B、通过编译,输出为: A B
C、通过编译,输出为: B
D、通过编译,输出为: A

单选题 给定java代码片段,如下: Integer a = new Integer(3); Integer b = new Integer(3); System.out.println(a==b); 运行后,这段代码将输出(选一项)

A、1
B、0
C、true
D、false