You can use scanner for getting the input from keyboard .For using scanner class you must import java.util.*; package. Syntax:Scanner in=new Scanner(System.in);data type of the variable and variable =in.nextdatatype of the variable();example:int I=in.next Int();