title: Why does this code not work as intended?
body: <p>I'm writing a simple method that takes grades as input from the user and calculates the Grade Point Average. Here is my code: </p>
  
  <pre><code>public static double calculateGPA(){
     Scanner in = new Scanner(System.in);
  
     double totalGradePoints = 0; // total grade points
     int numClasses = 0; // total classes completed
     boolean doneInput = false; // returns true when use is done inputting grades
  
     System.out.println("Enter all your grades (A,B,C,D,F) and enter 'done' if you are done entering your grades.");  
     while (!doneInput) {     
        String grade = in.next();
  
        if (grade == "A") {
           totalGradePoints += 4;
           numClasses++;
        } else if (grade == "B") {
           totalGradePoints += 3;
           numClasses++;
        } else if(grade == "C") {
           totalGradePoints += 2;
           numClasses++;
        } else if(grade == "D") {
           totalGradePoints += 1;
           numClasses++;
        } else if(grade == "F") {
           numClasses++;
        } else {
           doneInput = true;
        } //end if - else-if - else statement
     }//end while loop
     double unwtGPA = (totalGradePoints/numClasses);
     return unwtGPA;
  }
  </code></pre>
  
  <p>When I tested the method, I was only able to input one grade and none of the variables incremented, can somebody tell me what's wrong with the code?</p>