title: Initializing new file in a switch statement
body: <p>I'm having trouble with a file initiation. Basically, I want my problem to randomly choose a file. This is the code I have currently:</p>
  
  <pre><code>public void doFile () throws FileNotFoundException
     {
  
        File one = new File ("RJOpening.txt");
        File two = new File ("RJBalcony.txt");
        File choice;
  
        int n = (int)(Math.random() * 2);
  
        switch (n)
        {
           case 1: choice = one; break;
           case 2: choice = two; break;
           default: break;
        } 
        Scanner input = new Scanner (choice);
  </code></pre>
  
  <p>The above gives me a compiler error on the Scanner input line, saying that variable "choice" was not initialized. I tried doing File choice = new File (), but obviously that doesn't work. Any suggestions?</p>