首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的输出为( )。 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
46
问题
下面程序的输出为( )。 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://www.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()
以下选项中,对于递归程序的描述错误的是
关于下面代码的描述,错误的选项是a=[1,2,3]a=’’Runoob’’
以下程序的输出结果是deffunc(num):num*=2m=1000print(func(m))
下面代码的执行结果县defgreeting(args1,*tupleArgs,**dictArgs):print(args1)print(tupleArgs)print(dictArgs)names=[’HTY’,’LFF’,’ZH’]in
随机试题
A.溶解、吸收B.分离、排出C.机化D.包裹、钙化E.硬化下肢干性坏疽的自然结局是
某广告公司2005年7月份发生下列业务:1.承揽为某企业制作广告,并收取广告费50万元,将该广告的一部分业务交给另一家广告公司制作,支付其广告制作费8万元;该广告制作完成后支付给媒体广告发布费10万元。2.为本市一食品公司在公交车上制作宣传广告,向对方
下列各项中,不通过“应交税费”科目核算的有()。
世界上规模最大、风景最优美的岩溶风景区是()。[2014年山西真题]
0.21021:4
下列选项中,关于中国古代科学技术的主要成就,说法错误的是:
下列属于判断事项导致的特别风险是()。
东汉光武帝是怎样加强中央集权的?
Canada’spremiers(theleadersofprovincialgovernments),iftheyhaveanybreathleftaftercomplainingaboutOttawaattheir
RisingTuitionintheUSEverySpring,USuniversityadministratorsgathertodiscussthenextacademicyear’sbudget.They
最新回复
(
0
)