title: What is causing the "Exception in thread "main" java.lang.NullPointerException" Error?
body: <p>So I am in the middle of a project and supposedly my code was fine for this
  part but I keep getting errors anyway. I'm not sure what my original problem was but I'm sure it's changed at some point during my changes. Despite it pointing to the the line with the problem, I just can't figure out the problem(s) is/are. What is causing the error? </p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
       at Cafe.setName(Cafe.java:14)
       at CubanCafe.main(CubanCafe.java:16)
  
  
  
  import java.util.Scanner;
  
  public class CubanCafe
  {
  
  public static void main(String[] args)
  {
      String stateName;
  
      Scanner scan =  new Scanner(System.in);
  
      System.out.print(" Enter state: ");
      stateName = scan.nextLine();
  
      Cafe cafeState = new Cafe(stateName);
      cafeState.setName();
      cafeState.setTaxRate();
      System.out.println(cafeState);;
      System.out.println(cafeState.getTaxRate());
    }
  }
  
  
  public class Cafe {
      private String state, name;
      private double taxRate;
  
      public Cafe(String state){
          state = state.toUpperCase( );   
          name = null;
          taxRate = 0;
  
      }
  
      public void setName(){
          if(state.equals("MD"))
               name = "Parkville Cuban Cafe";
          else if(state.equals("VA"))
               name = "Alexandria Cuban Cafe";
          else 
               name = null;
      }   
  
      public void setTaxRate(){
          if (state.equals("MD"))
              taxRate = .06;
          else if (state.equals("VA"))
              taxRate = .04;
          else
              taxRate = 0;
      }
  
      public double getTaxRate(){
          return taxRate;
  
      }
  
      public String toString(){
           return (name);
      }
  
  }
  </code></pre>