未分类题

Whichofthefollowingfragmentsmightcauseerrors?()

A.Strings="Gonewiththewind";Stringt="good";Stringk=s+t;
B.Strings="Gonewiththewind";Stringt;t=s[3]+"one";
C.Strings="Gonewiththewind";Stringstandard=s.toUpperCase();
D.Strings="homedirectory";Stringt=s-"directory";

【参考答案】

B, D
A:String类型可以直接使用+进行连接运算。
B:String是一种Object,而不是简......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)