How to get the user input using Scanner. Here the input is an integer that will be stored in int variable i.
Scanner sc = new Scanner(System.in); int i = sc.nextInt();