(31)Instance initializer(s) gets executed ONLY IF the objects are constructed.
实例初始化语句块只有在它建立后才会被执行。
(32)All comparisons involving NaN and a non-Nan would always result false.(对大多数朋友来说这可是个盲点噢)
所有关于 NaN(Not a Number) 和 non-NaN 的比较,都返回false.这条很重要。
(33)Default type of a numeric literal with a decimal point is double.
我在这里把Java成员变量默认初始化原则写一下:
成员变量类型 取值
byte 0
short 0
int 0
long 0L
char '\u0000'
float 0.0F
double 0.0D
boolean false
所有引用类型 null
(34)integer (and long ) operations / and % can throw ArithmeticException while float / and % will never, even in case of division by zero.
integer和long 操作 /和% 的话, 会抛出ArithmeticException,但是 float形不
会,即使是除以0。
(35)== gives compiler error if the operands are cast-incompatible.
==会产生编译错误,如果两边 不兼容的话。
(36)You can never cast objects of sibling classes( sharing the same parent), even with an explicit cast.
你永远不可能 转化具有同一个超类的类的对象,即使是刻意转化。
class A
class sonA extends A
对这种情况:
sonA 和 daughterA 之间不能相互转化。
即:sonA son = (sonA) daughterA();是非法的。
而:sonA son = (sonA) A();A father = (A) sonA();是合法的。
(37)equals returns false if the object types are different.It does not raise a compiler error.
equals() 返回 false 如果对象类型不同,但不产生 编译错误。
(38)No inner class can have a static member.(but static inner class can)
没有内部类可以拥有静态成员。(但静态内部类可以)
(39)File class has NO methods to deal with the contents of the file.(also the existing directory)
File类没有 任何 处理文件内容的方法。(当然,存在的目录也一样)
(40)InputStream and OutputStream are abstract classes, while DataInput and DataOutput are interfaces.
InputStream 和 OutputStream 是 抽象类,是 DataInput 和 DataOutput是 接口
第1页 | 第2页 | 第3页
时间:2007-5-8 7:54:10,点击:0
上一篇:菜鸟入门篇:如何快速的考取Java认证?【声明】:以上文章或资料除注明为Office吧自创或编辑整理外,均为各方收集或网友推荐所得。其中摘录的内容以共享、研究为目的,不存在任何商业考虑。被摘录的对象如有任何异议,请与本站联系,本站确认后将立即撤下。谢谢您的支持与理解!
相关评论
相关文章
推荐文章