title: Is Java serialization comparable with encryption?
body: <p>I just want to clear the concept about Java serialization process. It clearly states that it helps to convert the object's state in the sequence of byte, that means it helps to save the object's information into byte formed.</p>
  
  <p>My question is, is Java's Serialization and Deserialization process comparable with network's encryption and decryption process? Here is my simple code:</p>
  
  <pre><code>package com.java;
  
  import java.io.Serializable;
  
  public class employee implements Serializable
  {
     public String firstName;
     public String lastName;
  
  }
  </code></pre>
  
  <p>Here  class employee  implements the Serializable interface.and it has two variable firstName and lastName. It is very OK:</p>
  
  <pre><code>package com.java;
  
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.ObjectOutputStream;
  
  public class SerializaitonClass {
  
  public static void main(String[] args) {
  employee emp = new employee();
  emp.firstName = "Gary";
  emp.lastName = "Michel";
  
  try {
  FileOutputStream fileOut = new FileOutputStream("./employee.txt");
  ObjectOutputStream out = new ObjectOutputStream(fileOut);
  out.writeObject(emp);
  out.close();
  fileOut.close();
  System.out.printf("Serialized data is saved in ./employee.txt file");
  } 
  catch (IOException i) {
  i.printStackTrace();
  }
  }
  }
  </code></pre>
  
  <p>In the class  SerializaitonClass,create the employee object and access the instance variable(firstname,lastname) and initilize the value.</p>
  
  <p>When I run this,it creates employee.txt file.</p>
  
  <p>When open this file, I get like that</p>
  
  <pre><code>¬í sr com.java.employeeÜ@&lt;~â™` L    firstNamet Ljava/lang/String;L lastNameq ~ xpt Garyt Michel
  </code></pre>
  
  <p>so it converts the whole object's information into byte format. When I use deserialization then I get desired output.</p>
  
  <p>So, can I compare this process with encryption process in network? Maybe I'm totally wrong, so please help me understand.</p>