title: Java String Switch counting votes
body: <p>I've looked at several examples of using the switch statement with a string, and haven't been successful in making mine work. I'm just trying to count the number of votes for A or B, and when I compile this, it doesn't return any errors. When I run it though, I get a runtime error:
  Can anyone point out where I've gone wrong?</p>
  
  <pre><code>import javax.swing.JOptionPane;
  
  public class Votes {
  
     private String s_numVoters, singleVote;
     private static int v_numVoters = 0, v_countVotes = 0, aCount = 0, bCount = 0, invalidCount = 0;
  
     public int m_numVoters() {
  
        s_numVoters = JOptionPane.showInputDialog("How many voters will be voting today?");
        int v_numVoters = Integer.parseInt(s_numVoters);
  
        return v_numVoters;
     }
  
     public void countVotes(String[] votes) {
        do {
  
           singleVote = JOptionPane.showInputDialog("Voting system. Please, enter:\nA - To vote for candidate A.\nB - To vote for candidate B.\n"
                                                     + "Z - To finish the voting process.\nAnything else will be considered as an INVALID vote.");
  
           switch (votes[0]) {
              case "A":
                 aCount = aCount + 1;
                 break ;
              case "B":
                 bCount = bCount + 1;
                 break ;
              default :
                 invalidCount = invalidCount + 1;
           }
        } while (singleVote != "Z" || (aCount + bCount + invalidCount) &lt;= v_numVoters);
     }
  
     public static void main(String[] args) {
  
        Votes newVotes = new Votes();
        newVotes.m_numVoters();
        newVotes.countVotes(args);
        System.out.println(aCount + " " + bCount + " " + invalidCount);
     }
  }
  </code></pre>