1

In this I want that scanner is run continuously, when check out the words no sequence from list and type them. The problem is that after the first scanner is completed, the next one does not work. How can to do this programm that it works continuously?. Thanks.

System.out.println("Check out one of the names: John, Mike, Nick:"); 
    Scanner s=new Scanner(System.in);
    String a=s.nextLine();
    if(a.equals("John"){
    System.out.println("This is John");
    }

    a=s.nextLine();
    if(a.equals("Mike"){
    System.out.println("This is Mike");
    }

    a=s.nextLine();
    if(a.equals("Nick")){
    System.out.println("This is Nick");
    }
I want ask
  • 69
  • 7

0 Answers0