首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面的哪些程序段可能导致错误? ( ) Ⅰ:String s="Gone with the wind"; String t="good"; String k=s+t; Ⅱ:String s="Gone wit
下面的哪些程序段可能导致错误? ( ) Ⅰ:String s="Gone with the wind"; String t="good"; String k=s+t; Ⅱ:String s="Gone wit
admin
2009-03-15
25
问题
下面的哪些程序段可能导致错误? ( ) Ⅰ:String s="Gone with the wind"; String t="good"; String k=s+t; Ⅱ:String s="Gone with the wind"; String t; t=s[3]+"one"; Ⅲ:String s="Gone with the wind"; String standard=s.toUpperCase(); Ⅳ:String s="home directory"; String t=s-"directory";
选项
A、Ⅱ、Ⅲ
B、Ⅱ、Ⅳ
C、Ⅰ、Ⅳ
D、Ⅲ、Ⅳ
答案
2
解析
本题是考查对String操作符的理解和应用。Ⅰ段中,String类型可以直接使用+进行连接运算;Ⅱ段中,String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误;Ⅲ段中, toUpperCase()方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型);Ⅳ段中,String类型不能进行减(-)运算,错误。
转载请注明原文地址:https://jikaoti.com/ti/qVb0FFFM
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
查询所有1982年3月20日以后(含)出生、性别为男的学生,正确的SQL语句是
查询成绩在70分至85分之间学生的学号、课程号和成绩,正确的SQL语句是
如果在命令窗口执行命令“LIST名称”后主窗口中显示记录号名称1电视机2计算机3电话线4电冰箱5电线假定名称字段为字符型,宽度为6,那么下
假设表单上有一选项组:⊙男○女,如果选择第2个按钮“女”,则该选项组Value属性的值为
如果内存变量和字段变量均有变量名“姓名",那么引用内存变量的正确方法是
在深度为7的满二叉树中,叶子结点的个数为
公司中有多个部门和多名职员,每个职员只能属于一个部门,一个部门可以有多名职员。则实体部门和职员间的联系是
Python为源文件指定系统默认字符编码的声明是
在Java中,所有类的根类是______。
在Java中,3.14156D表示的是【】数。
随机试题
尺寸精度的检测,就是将测得的实际尺寸与理想尺寸进行比较。()
工件在花盘上装夹的基准面,一般在铣削之后还要进行磨削或精刮。()
某外贸公司在缴纳了100万元的税款后,采取虚报出口的手段,骗得税务机关退税180万元,后被查获。对该公司应如何处理()
关于无牙颌上颌结节的叙述,恰当的是
A.中府B.中脘C.中极D.膻中E.天枢
下列不属于基金职业道德教育的途径的是()。
贷款项目评估的出发点为()。
根据监管要求,我国系统重要性银行资本充足率不得低于()。
股利的支付可减少管理层可支配的自由现金流量,在一定程度上抑制管理层的过度投资或在职消费行为。这种观点体现的股利理论是()。
保证班主任科学性、针对性和实效性的前提是()。
最新回复
(
0
)