题目内容 (请给出正确答案)
[单选题]

以下代码片段: String s1 = "hello"; String s2 = "hello"; System.out.println(s1 == s2); 以下哪句是正确的?

A.输出“true”

B.输出“false”

C.不能编译

D.运行时刻出现异常

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“以下代码片段: String s1 = "hello"; S…”相关的问题

第1题

以下程序片段的输出结果为( )。 public static void main(String[] args) { String s1="hello"; String s2=new String("hello"); if(s1.equals(s2)) { System.out.println("相等");} else { System.out.println("不相等"); } }

A、相等

B、不相等

C、true

D、false

点击查看答案

第2题

定义字符串:String s1="hello";对下面程序描述正确的是: if(s1=="hello"){ System.out.println("s1 = \"hello\""); }else{ System.out.println("s1 !=hello"); }

A、输出 s1 !=hello

B、编译正确,运行错误

C、产生编译错误

D、输出 s1="hello"

点击查看答案

第3题

【单选题】给出下面一段程序,选择运行结果 public class Testequals { public static void main(St
ring[] args) { String s1="Hello"; String s2="Hello"; String s3=new String("Hello"); System.out.println(s1==s2); System.out.println(s1==s3); System.out.println(s1.equals(s3)); } }

A、true false false

B、true false true

C、false false false

D、true true false

点击查看答案

第4题

1、请说出下列代码的执行结果( )。 String s=new String(”abc”); String s1=new String(s); if(s==s1){ System.out.println(”Hello”); } if(s.equals(s1)){ System.out.println(”World”); }

A、Hello World

B、Hello

C、World

D、没有输出

点击查看答案

第5题

【单选题】顺序执行下面2个语句,输出的结果是( ) 。 String s="hello! "; System.out.println(s.length());

A、6

B、7

C、5

D、8

点击查看答案

第6题

写出以下程序的运行结果? public class Test{ public static void main(String argv[]){ String
s = new String("hello"); myMethod(s); System.out.println("s=" + x); } public static void myMethod(String s){ s = s + "!"; } }

A、s=hello!

B、s=hello

C、hello!

D、hello

点击查看答案

第7题

import java.io.*; public class abc { public static void main(String args [ ]) { AB s = new
1、 import java.io.*; public class abc { public static void main(String args [ ]) { AB s = new AB("Hello!","I love VA"); System.out.println(s.toString( ); } } class AB { String s1; String s2; public AB(String str1, String str2) {sl = str1; s2 = str2;} public String toString( ) { return s1+s2; }

点击查看答案

第8题

下列代码段的执行结果是( )。 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

点击查看答案

第9题

下列代码段的执行结果是( )。 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

点击查看答案

第10题

【单选题】(2-5)下面程序段的输出结果是( )。 String s0 = new String("hello,中国!"); System.out.println(s0.length());

A、10

B、11

C、9

D、15

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信