Input through Keyboard

/*The following program is written in a very simple form to show the keyboard input from the programmer which
returns the corresponding value conditioned by the if-statement in the method min(int, int) */


public class KeyBoardInput {

public static int min( int a, int b) {

if (a <= b)
return a;
return b;

public static void main(String[] args) throws IOException {

int x;
int y;

String sb;
String ks;

BufferedReader bk = new BufferedReader (
new InputStreamReader(;

System.out.println ("Enter x ");

sb = bk.readLine();
x = Integer.parseInt(sb);

System.out.println("Enter y");

ks = bk.readLine();
y = Integer.parseInt(ks);


System.out.print("The returned value is = ");
System.out.println(Math.min(x * 5, y + 20));