首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的输出为( )。 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
67
问题
下面程序的输出为( )。 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全国计算机二级
相关试题推荐
下面代码的输出结果是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’’
执行下面的代码,运行正确的是deff(x,y=0,z=0):pass
执行下面代码,运行错误的是deff(x,y=0,z=0):pass
随机试题
下列不符合产前诊断适应证的是
以不正当手段取得医师执业证书的
下列有关标准差系数的叙述,正确的说法有()。
特殊风险包括()。
下列关于经济业务会计计量属性的表述中,正确的有()。
在MMPI-2新增加的效度量表中,TRIN是()的英文缩写。
(2020年国考)下列言论中涉及的人才选拔制度,按出现顺序先后排列正确的是()。①学通行修,经中博士②宗师非有军功论,不得为属籍③九品访人,唯问中正④风吹金榜落凡世,三十三人名字香
Whichdoesthewomanlikebest?
GeorgeOrwell’sNineteenEighty-fourwasfarmoreprescientthananypersonwhogrewupinthemiddledecadesofthe20thcentur
Myuncleisquitewornoutfromyearsofhardwork.Heisnolongertheman______hewasfifteenyearsago.
最新回复
(
0
)