take input from stdin in java code example
Example: java stdin
public static void main(String[] args) {
StdOut.print("Type an int: ");
int a = StdIn.readInt();
StdOut.println("Your int was: " + a);
StdOut.println();
}
}