Whichofthefollowingrangeofshortiscorrect
-27--27-1B
0–216-1C
215–215-1D
231–231-1翻译:下面哪些是short型的取值范围
答案::C解析:短整型的数据类型的长度是16bits,有符号
另外需要说明的是java中所有的整(Integral)数(包括byte,short,int,long)全是有符号的
Whichdeclarationsofidentifiersarelegal
$personsB
TwoUsersC
*pointD
_endline翻译:下面哪些是合法的标识符
答案:A,B,E解析:Java的标识符可以以一个Unicode字符,下滑线(_),美元符($)开始,后续字符可以是前面的符号和数字,没有长度限制,大小写敏感,不能是保留字
Whichstatementofassigningalongtypevariabletoahexadecimalvalueiscorrect
longnumber=345L;B
longnumber=0345;C
longnumber=0345L;D
longnumber=0x345L翻译:哪些是将一个十六进制值赋值给一个long型变量
答案D解析:十六进制数以0x开头,long型数以L(大小写均可,一般使用大写,因为小写的l和数字1不易区分)
Whichofthefollowingfragmentsmightcauseerrors
Strings="Gonewiththewind";Stringt="good";Stringk=s+t;B
Strings="Gonewiththewind";Stringt;t=s[3]+"one";C
Strings="Gonewiththewind";Stringstanda