title: Using Scanner to read the
body: <p>When I want to read the name of the user using the scanner and then assging the value of the name in a string and after that invoking the method getName and give it an argument of the name to print out my name is ...., my code just crash and does not work I tried to figure out the problem but I could not</p>
  
  <pre><code> public void getName(String name)
     {
         String s = "your name is: "+name   ;
     }
      public void userInput()
      {
          print();
          Scanner s = new Scanner(System.in);
          String read = s.nextLine();
          String op = read;
          while(!read.equals("Exit"))
          {  
              switch (op){
                  case "a" :
                  System.out.println("type your name:");
                  read = s.nextLine();
                  getName(read);
                  print();
                  read = s.nextLine();
                  op = read;
                  break;
                  case"b" :
                  System.out.println("by");
                  print();
                  read = s.nextLine();
                  op = read;
                  break;
              }
  
          }
      }
  
      public void print()
      {
          System.out.println("press a");
          System.out.println("press b");
      }
  </code></pre>