The transient and volatile Modifiers

When an instance variable is declared as transient, then its value need not persist when an object is stored. For example:

class T { 
   transient int a; // will not persist 
   int b; // will persist 

The volatile variables can be changed unexpectedly by other parts of your program.

  Java Book