title: NullPointerException when object is instantiated
body: <p>This is a homework, I would appreciate any kind of answer.</p>
  
  <p>Im trying to figure out why i keep getting a NullPointerException when i call the equals method. I have instantiated the object if im not mistaken, but it still doesn't work.</p>
  
  <pre><code>Exception in thread "main" 8
  java.lang.NullPointerException
      at labbfyra.TextBuilder.equals(TextBuilder.java:69)
      at labbfyra.SkapaOrd.main(SkapaOrd.java:17)
  </code></pre>
  
  <p>Is this the stacktrace?</p>
  
  <pre><code>public class TextBuilder {
  
      private static class Node{
          public char   inChar;
          public Node   next;
  
          public Node(char c, Node nästa){
              inChar = c;
              next = nästa;
  
          }
      }
  
      private  Node   first = null;
      private Node   last = null;
  
      public TextBuilder(){
          first = null;
          last = null;
      }
  
      public void append(String s){
          int x = s.length();
          for(int i=0;i&lt;x;i++){
  
  
              Node   n  = new Node(s.charAt(i),null);
  
  
              if(first ==null){
                  first = n;
                  last = n;
  
              }else{
                  last.next = n;
                  last = n;
  
              }
          }
      }
  
      public int ShowSize(){
          int counter = 0;
  
          Node   n = first;
          while(n!=null){
              counter++;
              n=n.next;
          }
          return counter;
      }
  
      public boolean equals(String s){
  
          boolean   eq = false;
          int   counter = 0;
          char[]   cArray = s.toCharArray();
          char[]   cArrayComp = new char[10];
  
  
          Node   n = first;
          cArrayComp[counter] = n.inChar;
  
          while(n!=null){
              counter++;
              n=n.next;
              cArrayComp[counter] = n.inChar; //THIS IS LINE 69
          }
          if(cArrayComp==cArray){
                  eq = true;
          }   
          else{
              eq=false;
          }
          return eq;
      }
  }
  </code></pre>