0 votes

1 Answer

0 votes
by
How to use scanner in java?

import java.util.Scanner;

class classname{

  public methodname(){

    //Scanner declaration

    Scanner s_name = new Scanner(System.in);

    //Use Scanner to take input

    int val = s_name.nextInt();

  }

}
...