1.Declaration And Access Control

1General Comments'static' and 'final' are valid modifiers for both 'variable' and 'method' declarations within a class.
'transient' and 'volatile' modifiers are only valid for 'variables'.
'abstract' and 'native' are only valid for 'methods'.
Note: a class can have only have 'final', 'abstract' and 'public' as modifiers.

2.1private, protected and public can be applied to an Inner class.
2.2synchronized  can only be applied to a method or a block.
2.3 final keyword when applied to a class means the class cannot be subclassed, when applied to a method means the method cannot be overridden (it can be overloaded though) and when applied to a variable means that the variable is a constant. 

3.1. Even if the program is executed without any arguments, the 'args' is NOT NULL. In such case it will be initialized to an arry of Strings of zero elements.
3.2. The finally block is always executed, no matter how control leaves the try block. Only if, in try or catch, System.exit() is called then finally will not be executed

4.1 父类中 protected 的成员,子类中可通过继承访问,或通过实例父类对象后访问(不推荐).如果是子类中方法中通过参数引用父类 protected 的成员,这些 protected 的成员是不可见的(子类中)

5.1 如果子類所有構造函數,沒有用super(),就默認使用super();

6 Local variable don't have any accessiblity. They are accessible only from the block they are declared in.

7First, static statements/blocks are called IN THE ORDER they are defined.
  Next, instance initializer statements/blocks are called IN THE ORDER they are defined.
  Finally, the constructor is called.

8.If you explicitly specify the members then you can't give the size. So option 2 is wrong.
The size of the array is never given during the declaration of an array reference. So option 5 is wrong. int i[4] = { 1, 2, 3, 4 } ;
The size of an array is always associated with the array instance, not the array reference.int  i[ ] = new int[2] {1, 2} ;   

9 The native keyword is applicable to methods only.
A native method cannot be abstract but it can throw exception(s).
一般是指未经官方文档公开的系统api,这类api大都存在于nt平台上,由于涉及到对系统内部底层资源的调用因此在完成类似的功能时速度可能更快、效率可能更高注意只是“可能”,因为未经公开,也有可能不够稳定或者在下个版本的平台中不被支持
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值