题目内容 (请给出正确答案)
[主观题]

public class ChangeStrDemo { public static void changeStr(String str){ str="welcome"; } pu

public class ChangeStrDemo { public static void changeStr(String str){ str="welcome"; } public static void main(String[] args) { String str="home"; changeStr(str); System.out.println(str); } }给出程序的运行结果()

A、welcome

B、home

C、无输出

暂无答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“public class ChangeStrDemo { p…”相关的问题

第1题

publicclassTest{publicstaticvoidmain(String[]args){Stringfoo=args[1];Stringbar=args[2];Stringbaz=args[3];System.out.printIn(baz=”+baz);}}Andtheoutput:Baz=2Whichcommandlineinvocationwillproducetheoutput?()

A.JavaTest2222

B.JavaTest1234

C.JavaTest4242

D.JavaTest4321

点击查看答案

第2题

下面成运行的结果是 abstract class A { public abstract void printStr(string str); } class B : A { public override void printStr(string str) { str = str + "override"; Console.WriteLine(str); } static void Main(s

A、print

B、override

C、print override

D、编译出错

点击查看答案

第3题

import java.io.*;

public class abc

{

public static void main(String args[ ])

{

AB s = new AB("Hello!","I love JAVA.");

System.out.println(s.toString( ));

}

}

class AB

{

String s1;

String s2;

AB (String str1 , String str2 )

{

s1 = str1;

s2 = str2;

}

public String toString( ) { return s1+s2;

}

}

点击查看答案

第4题

下面程序的运行结果是()

public classexample{

public static void main(string[] args) {

string[] strs = { "tom", "jerry","donald" };

for (string str : strs) {

str = "tuffy"

}

system.out.println(strs[0] + "," + strs[1] +","

+ strs[2])

}

}

A、Tom,Jerry,Donald

B、Tuffy,Jerry,Donald

C、Tuffy,Tuffy,Tuffy

D、发生异常,输出异常信息

点击查看答案

第5题

【判断题】(10-8)运行下面程序,输出结果是true。 public class Demo6 { public static void main(String[] args) { String str1="good"; String str2="good"; System.out.println(str1==str2); } }
点击查看答案

第6题

阅读下面小程序,选出正确答案()。 public class TestString { public static void main(String[] args) { String str = "I am a String!"; int n=str.length(); char c=str.charAt(7); System.out.println(n); System.out.println(

A、14 S

B、14 t

C、11 S

D、10 r

点击查看答案

第7题

1.publicclassXimplementsRunnable(2.privateintx;3.privateinty;4.5.publicstaticvoidmain(String[]args)6.Xthat=newX();7.(newThread(that)).start();8.(newThread(that)).start();9.)10.11.publicvoidrun()(12.for(;;)(13.x++;14.y++;15.System.out.printIn(x=”+x+,y=”+y);16.)17.)Whatistheresult?()

A.Errorsatlines7and8causecompilationtofail.

B.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”).

C.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=1,y=1”).

D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearsonlyforonce(forexample,“x=1,y=1”followedby“x=2,y=2”).

点击查看答案

第8题

下列程序运行的结果为:

public class Example{

String str=new String("good");

char[] ch={'a','b','c'};

public static void main(String args[]){

Example ex=new Example();

ex.change(ex.str,ex.ch);

System.out.print(ex.str+" and ");

Sytem.out.print(ex.ch);

}

public void change(String str,char ch[]){

str="test ok";

ch[0]='g';

}

}

A. good and abc

B. good and gbc

C. test ok and abc

D. test ok and gbc

点击查看答案

第9题

8、下列代码中有哪些语句是错误的,请指出语句编号: class MyClass { private string str1; ①static string str2; public MyClass(string _str1,string _str2) { str1 = _str1; ②str2 = _str2; } public void Display() { ③Console.WriteLin

A、①

B、②

C、③

D、④

点击查看答案

第10题

已知: public class Hello { public int m(int x) { int r = 1; r += x; if ((x > 5) && (x < 10)) { r += 2 * x; } else if (x <= 4) { r +="3" * x; } else return r; public static void main(str

6、已知: class C { int i = 1; int j = 2; public void swap() { int temp = i; i = j; j = temp; } public static void main(String[] args) { C c = new C(); c.swap(); System.out.println(c.i + "," + c.j); } } 的输出为

A、1,1

B、1,2

C、2,1

D、2,2

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

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

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

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

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