首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1;
下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1;
admin
2010-12-17
53
问题
下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }
选项
A、The output is xy
B、The output is 3
C、The output is 12
D、The output is x=1 y=2
答案
C
解析
Java表达式的同级运算符从左到右进行,括号可以改变优先级。“+”在Java中既是算术的加号,也可以作为字符串的连接符号。“The output is”+x+y中,字符串“The output is”先与x做字符串的连接,结果字符串“The output is 1”再与y做字符串连接。
转载请注明原文地址:https://kaotiyun.com/show/K79p777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
下面是一个传感器采集数据文件sensor-data.txt的一部分:2018-02-2801:03:16.3339319.302438.462945.082.687422018-02-2801:06:116.01345319.16523
下面代码的输出结果是defhello_world():print(’ST’,end=’’*’’)defthree_hellos():foriinrange(3):hello_world()three_hellos()
下面代码的输出结果是deff2(a):ifa>33:returnTrueli=[11,22,33,44,55]res=filter(f2,li)print(list(res))
关于下面代码的描述,错误的选项是a=[1,2,3]a=’’Runoob’’
下面代码的执行结果县defgreeting(args1,*tupleArgs,**dictArgs):print(args1)print(tupleArgs)print(dictArgs)names=[’HTY’,’LFF’,’ZH’]in
执行下面的代码,运行正确的是deff(x,y=0,z=0):pass
执行下面代码,运行错误的是deff(x,y=0,z=0):pass
随机试题
简述中国社区发展的原则。
以下哪个凝血因子不参与凝块形成
某地区1980年度疫情资料统计,狂犬病患者100人全部死亡,该资料可计算
图示均质链条传动机构的大齿轮以角速度ω转动,已知大齿轮半径为R,质量为m1,小齿轮半径为r,质量为m2,链条质量不计,则此系统的动量为()。
下列()业务的处理符合权责发生制。
议付
下列关于对基金管理人的从业人员证券投资的限制的说法,不正确的有()。
下列属于税务登记代理范围的有()。
洋务派举办的洋务事业包括()
Afterits【L1】______tothe【L2】______in2001,Chinahastakenstepstowardsopeningupits【L3】______.Asaconditionforjoiningt
最新回复
(
0
)