title: Error: Exception in thread "main" java.lang.NullPointerException
body: <p>I am getting this error as a result on my code.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.util.*;
  public class car{
  public static void main(String[]args) throws java.io.IOException{
  Scanner v = new Scanner(System.in);
  
  String model = new String(); 
  double cost=0;
  
  System.out.print("Enter model: ");
  model = System.console().readLine();
  
  if(model == "GL"){
      cost = 420000;
      }
  
  if (model == "XL"){
      cost = 3398000;
      }
  
  
  
  
  
  
  System.out.print("Car phone: ");
  char phone = (char)System.in.read();
  
  if(phone == 'W'){
  cost = cost + 40000;
  }
  
  System.out.print("Full or installment: ");
  char paid = (char)System.in.read();
  
  if(paid == 'F'){
  cost = cost - 0.15 * cost;
  }
  
  System.out.print("Cost: " + cost); 
  
  }
  }
  </code></pre>
  
  <p>and this is the result. An error:
  Enter model: Exception in thread "main" java.lang.NullPointerException
      at car.main(car.java:10)</p>