最近在看scjp的TIP。
有这几句话:
8.A transient variable may not be serialized.
9. The transient keyword is applicable to variables only.
10. The native keyword is applicable to methods only.
请问是什么意思?感觉以前看书没见到过。
有这几句话:
8.A transient variable may not be serialized.
9. The transient keyword is applicable to variables only.
10. The native keyword is applicable to methods only.
请问是什么意思?感觉以前看书没见到过。
8.transient变量可以不是序列化的。//不过一般transient变量都是序列化的。
9.transient关键字只能形容变量。//呵呵,这个容易劣迹
10.native关键字字能形容方法。//这个也是。native一般就是去调用本地方法,难道还有本地变量?不可能
To use the native methods in java we use the keyword native
public native method_a()
This native keyword is signal to the java compiler that the implementation of this method is in a language other than java.
Native methods are used whenwere alize that it would take up a lot of rework to write that piece of already existing code in other language to java.