title: View input in Heap Memory
body: <p>I'm studying from the Java Coding Guidelines of Fred Long.
  There is an example in which he says that if I store the login in a string, this data is visible to anyone in the Heap Memory, until the Garbage acts. 
  For this reason, he recommends inserting data into an array of characters, so that you can delete them as soon as we do not need them.
  Now here's my problem: how can I view the Heap Memory run-time content to see the data? I tried to create a .exe that contains the jar with the Login class, and then run it with the OllyDbg debugger, but I could not. Can you help me? thanks</p>
  
  <pre><code>import java.io.BufferedReader; 
  import java.io.IOException;
  import java.io.InputStreamReader; 
  
  public class Login {
      private String username;
      private String password;
  
      public Login(String user, String password){ 
          this.username = user;
          this.password = password;
      } 
  
      @Override
      public String toString(){
          return "Username: " + this.username + " - Password: " +     this.password;
      }
  
  
  
      public static void main(String[] args) throws IOException {
          BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
  
          System.out.println("Enter Username:"); 
          String username = buffer.readLine();
  
          System.out.println("Enter Password:");
          String password = buffer.readLine();
  
          Login log = new Login(username,password); 
  
          System.out.println("Press Any Key To Continue...");
          new java.util.Scanner(System.in).nextLine();
      }
  }
  </code></pre>