karellism
2/15/2019 - 8:40 AM

Input using Scanner in Java

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();