- 1、本文档共26页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
java认证 习题 第03章 有答案版 OK 该试题还有第02、04章
1、class Scoop{
static int thrower() throws Exception { return 42; }
public static void main(String[] args) {
try{
int x = thrower();
}catch(Exception e) {
x++;
}finally {
System.out.println(“x = ” + ++x);
}
What is the result?
A. x = 42
B. x = 43
C. x = 44
D. Compilation fails
E. The code runs with no output
答案:D
变量x的作用域只在try块 D class Example
{
static int myArg=1;
public static void main(String [] args)
{
Int myArg;
System.out.println(myArg);
}
}
Select all right answer:
A、 this code compiles and displays 0 in the statndard output when run
B、 this code compiles and displays 1 in the statndard output when run
C、 this code does not compile because you can?t define a local variable names the same as static
variable
D、 this code doesn?t compile because the local vriable is used before it is initialized
局部变量 myArg;在使用前必须被初始化
3、what is the result when you compile and run the following code? D class Example
{
static int i;
public static void main(String [] args)
{
System.out.println(i);
}
}
Select all right answer:
A、 Error variable I may not have been initialized
B、 Null
C、 1
D、 0
属性有默认值
4、what is the result when you compile and run the following code? class Example
{
static boolean Paddy;
public static void main(String [] args)
{
System.out.println(Paddy);
}
}
Select all right answer:
A、 compile time error;
B、 compilation and output of false;
C、 compilation and output of true
D、 compilation and output of null
属性有默认值
5、what is the result when you compile and run the following code? class Example
{
public static void main(String [] args)
{ int i=012;
int j=034;
int k=056;
int l=078;
System.out.println(i);
System.out.println(j);
System.out.println(k);
}
}
Select all right answer:
A、 prints 12,34 and 56
B、 prints 24,68and 112
C、 prints 10,28and 46
D、 compilation error
八进制数前加0,但l表示的数超过八进制数的范围了 B D
6、what is the result when you compile and run the following code? A class Example
{ void fun()
{
s
文档评论(0)