title: How to use a String inside a Switch Statement in Java
body: <p>My input String wont appear when im running the code. First it said it was unusable when i had it inside my Main method. After i took it out of my Main method and placed it in the Public class and the unusable problem got away. But still it wont appear while running the code.</p>
  
  <pre><code>public class Number0to9 {    
    public static String input;
  
    public static void main(String[] args) {        
      tryagain: while (true) {
        System.out.print("Type a number between 0 and 9 : ");
  
        Scanner scan = new Scanner(System.in);          
        int x = scan.nextInt();
        int output = x;
        input = "You entered number: ";
  
        switch (x) {
          case 0:
            input += output;
            break tryagain;
          case 1:
            input += output;
            break tryagain;
          case 2:
            input += output;
            break tryagain;
          case 3: 
            input += output;
            break tryagain;
          case 4:
            input += output;
            break tryagain;
          case 5: 
            input += output;
            break tryagain;
          case 6: 
            input += output;
            break tryagain;
          case 7:
            input += output;
            break tryagain;
          case 8:
            input += output;
            break tryagain;
          case 9:
            input += output;
            break tryagain;
          default:
            System.out.println("Your number was bigger than 9");
            break;
        }   
      }        
    } 
  } 
  </code></pre>