Java accepting only numbers from user with Scanner
问题 I am trying to understand how to only accept numbers from the user, and I have attempted to do so using try catch blocks, but I would still get errors with it. Scanner scan = new Scanner(System.in); boolean bidding; int startbid; int bid; bidding = true; System.out.println("Alright folks, who wants this unit?" + "\nHow much. How much. How much money where?" ); startbid = scan.nextInt(); try{ while(bidding){ System.out.println("$" + startbid + "! Whose going to bid higher?"); startbid =+ scan