Java

本类阅读TOP10

·使用MyEclipse开发Struts框架的Hello World!(录像1)
·hibernate配置笔记
·AOP编程入门--Java篇
·linux下Tomcat 5.0.20 与 Apache 2 安装/集成/配置
·在win2003下整合了整合Tomcat5.5+ apache_2.0.53+ mod_jk_2.0.47.dll
·构建Linux下IDE环境--Eclipse篇
·Jsp 连接 mySQL、Oracle 数据库备忘(Windows平台)
·ASP、JSP、PHP 三种技术比较
·Tomcat5.5.9的安装配置
·AWT GUI 设计笔记(二)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
关于SCJP1.4考试的一些需要注意的地方(二)

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

接上文:

21An instance sl of a class S that extends a class B,where B declares the protected member and where sl is referring to one of the following:

1.its own copy of the proteched member inherited from B

2.a copy of the protected member owned by another instance S2 fo S (and therefore inherited from B)

3.a copy of the protected member owned by an instance of a subclass of S

22. null false true 不是保留字

23Float f1=0.0f;

       Float f2=-0.0f

       Double d1=0.0

       Double d2=-0.0

       Int i=0

       F1=f2=d1=d2=i

24.  char a=’\u0061’;

        Char \u0061=’a’;

        Ch\u0061r \u0061=’\u0061’

25.           methodA(){

  int I,j;

    if(true){i=1;}

    if(i==1){j=2;}

    System.out.println(i);  (right)

    System.out.println(j);  (wrong)

}

Reason :

If the java compiler can immediately determine the value of Boolean expression within an if() statement,it will not generate code to evaluate the expression at runtime,if the compiler can determine that the Boolean expression is always false,it will not generate code for the corresponding compound statement.

26.           constructor and abstract method can not be declared static final sychnorized native or strictfp

27.           final 变量必须赋值,否则编译无法通过

28.           int i=j; int j=1  (wrong)

int i=j; static int j=1; (right)   因为static初始化早

29.           int []a={1,2}

int []b=(int[])a.clone();   此时: a<>b

30.           stclass s=new stclass();

s=null;

s.amethod();  //valid only if the amethod() is static one

31.   String x=new String();

        String y=new String(“”);

Both x and y creat an empty string

32           min(-0.0,0.0)=-0.0

33           class A{}

class B extends A{}

class C extends A{}

A a=new A();

B b=new B();

C c=new C();

       Compiler      runtime

 a=b    right          right

 b=c;    wrong        wrong

 b=(b)c  wrong        wrong

b=(b)a;  right         may be wrong

 b=a;     wrong       wrong

 a=(a)b;   right        right

 

34. int x=6; double y=9.7;

       System.our.println((x<y)?9:8.6);   输出9.0

       System.our.println((6<9.7)?9:8.6);  输出9

35boolean b=new boolean(“true”);

       boolean b2=new boolean(“asdfad”);

   b=true b2false

36Synchnorized ―――

class methodinstance methoda part in method

37switchk k―――byte char int

38wait must be called inside sychronized code

39. class A{

       static{

       System.out.println(“sdfasd”);

}

}

此部分并不是实例化一次就执行一次,而是loadjvm时执行一次,即 java A时执行一次

40 int a=(octal)5;  octal不是合法字符

 




相关文章

相关软件