Java serialized 48-final keyword

A, final keyword

1. Notes:

(1) final is a keyword, represented the ultimate, immutable.

(2) final modified class can not be inherited

(3) final modified method can not be covered

(4) final modified variables, once assigned, can not be reassigned

(5) final modified instance variables

(6) final modified references

 

package com.bjpowernode.java_learning;


public class D48_FinalKyeWord {

  public static void main(String[] args) {

    Exercise_48_1 e1 = new Exercise_48_1();

  }

}

final class Exercise_48{ 

}

class Exercise_48_1 extends Exercise_48{

}

 

 

 

2. About how to connect the source myeclipse

Open a .class bytecode files, see the source code when there is no time: Click "Attach Source" "

-workspace ... source code in the current workspace

-External File ... source in an archive in,

-External Folder ... source code in a directory

3. For the library after learning usually consists of three parts: source (see the source code to understand the program), byte code (used during program development is this part), help documentation (explanation of the source code is extracted it is more convenient to program development)

4.java language of the final rule after modification using the final, you must manually assign instance variables, can not use the system default.

For example

 

Final  int i; // compile error, because no assignment.


// or use the construction method assigned to it

public  class test1 {

  final int i ;

  public test1{

    self.i = 100;

   }

  final User u1 = new User("jfoae");

  u1 = new new the User ( "iefr"); // this will compile error, because the reference u1 are final modified, stored inside the object address can not be reassigned. 

  u1.id = 89; // compiles successfully, final modification of the reference points to an object after though, but the interior of the object at the memory can be modified.

 

 

V. Source:

D48_FinalKyeWord.java

address:

https://github.com/ruigege66/Java/blob/master/D48_FinalKyeWord.java

2.CSDN: https: //blog.csdn.net/weixin_44630050 (Xi Jun Jun Moods do not know - Rui)

3. Park blog: https: //www.cnblogs.com/ruigege0000/

4. Welcomes the focus on micro-channel public number: Fourier transform public personal number, only for learning exchanges, backstage reply "gifts" to get big data learning materials

 

 

Guess you like

Origin www.cnblogs.com/ruigege0000/p/11809706.html