Java考试格林练习试题
question 6)
which of the following are keywords or reserved words in java?
1) if
2) then
3) goto
4) while
5) case
question 7)
which of the following are legal identifiers
1) 2variable
2) variable2
3) _whatavariable
4) _3_
5) $anothervar
6) #myvar
question 8)
what will happen when you compile and run the following code?
public class myclass{ static int i; public static void main(string argv[]){ tln(i); }}
1) error variable i may not have been initialized
2) null
3) 1
4) 0
question 9)
what will happen if you try to compile and run the following code?
public class q { public static void main(string argv[]){ int anar[]=new int[]{1,2,3}; tln(anar[1]); }}
1) 1
2) error anar is referenced before it is initialized
3) 2
4) error: size of array must be defined
question 10)
what will happen if you try to compile and run the following code?
public class q { public static void main(string argv[]){ int anar[]=new int[5]; tln(anar[0]); }}
1) error: anar is referenced before it is initialized
2) null
3) 0
4) 5
-
java有哪几种认证
Sun认证Java程序员考试内容涉及Java所有相关知识、编程概念及applet开发技巧。以下是小编整理的关于java的认证种类,希望大家认真阅读!Java程序员认证一、怎样可以获得Sun公司的Java认证?如果你希望取得Sun公司Java认证,那么必须通过Java程序员(SCJP)的考试。授...
-
java面试题大全带答案
为了能够提高自身能力,每年都会有大量的人员参加Java认证考试。下面是小编整理的关于java面试题大全带答案,欢迎大家参考!isoracle.ismajordiffereneceoracle8iandoracle9i.mesomethingurself.setellmeaboutoops.issingleinheritance.ismultipleinheritance.java...
-
关于Java动态代理的解析
动态代理类是位于ect包下的InterfaceInvocationHandler。下面小编准备了关于Java动态代理的解析,提供给大家参考!众所周知,JDK的动态代理模式必须实现接口。以下面的源码为例:接口一:publicinterfaceActionInterface{voiddoSelf(Stringstr);StringgetType();}接口...
-
Java中最常见的错误盘点
在编程时,开发者经常会遭遇各式各样莫名错误。近日,SushilDas在GeekOnJava上列举了Java开发中常见的5个错误,一起跟yjbys小编来看看吧!1、Null的过度使用避免过度使用null值是一个最佳实践。例如,更好的做法是让方法返回空的array或者collection而不是null值,因为这...