title: which is the apt java keyword to skip java serialization
body: <p>In a process of leaning java serialization concept, i was puzzled at one point. In java serialization process, we use 2 keywords to prevent serialization, i.e.., transient and static. If i don't want to save an instance variable, which keyword should i use, both does exactly the same.</p>
  
  <pre><code>Class A implements Serializable{
    private static int x;
    private transient int y;
    private transient static int x;
  }
  </code></pre>
  
  <p>In the above code all the three instance variables are not saved in a process of serialization. Which keyword is apt and recommended to prevent serialization. Why does two keywords have almost the same functionality. What is the recommended way of declaration to prevent serialization. Correct me if I'm wrong, I'm still learning.</p>