Why this code doesnât works in sololearn editorđ?
import java.util.*; public class Program { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int x = getIntInput(); System.out.println(x); } public static int getIntInput(){ int choose = 0; while (choose == 0){ try{ choose = scanner.nextInt(); if(choose == 0){ throw new InputMismatchException(); } scanner.nextLine(); } catch(InputMismatchException e){ scanner.nextLine(); System.out.print("\nERROR: INVALID INPUT.\nPlease try again: "); } } return choose; } }