35 Java serialization class summary, null pointer exception

A summary

1. The stack is stored in memory in the main body of a local variable in the method

2. The object has an internal instance variables, instance variables stored in the heap memory

3. Variable Categories: Local variables (method declared in the body); member variable (in vitro method declarations)

Instance variables (front modifier is not static) static variables (modifier in front there is static)

4. The method of static variables are stored in the memory area.

The three most frequent variation in memory stack memory, garbage payback period is aimed primarily heap memory

6. When the garbage collector (automatic recovery mechanism, GC mechanism) will consider a java objects recovered memory of it?

(1) when the heap becomes garbage java object data, the garbage collector will be recovered

(2) java objects when the heap of garbage will become of it?

. I no more references to it at the time;. Ii This object can not be accessed because the access object can only be accessed by reference.

Second, the null pointer exception

1. The following program is compiled through, because it is consistent syntax, but there will be a null pointer exception runtime: java.lang.NullPointerException. Null reference access "instance" of the relevant data will appear null pointer exception

 

    S = Student new new Student (); 

    System.out.println (s.age); 

    S = null ; 

    // above program is compiled through, because it is consistent syntax, but there will be a null pointer runtime exception: java.lang .NullPointerException 

    // null reference to access relevant data "instance" there will certainly be a null pointer exception 

    System.out.println (s.age);

Third, the source code:

D35_void_pointer_exception.java

address:

https://github.com/ruigege66/Java/blob/master/D35_void_pointer_exception.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/11595363.html