You have to create a Main class
and call add and sub class from it.
You can do it like this
from command prompt run
>main add 5 6
In Main class type
# BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
# int a=Integer.parseInt(br.readLine());
# int b=Integer.parseInt(br.readLine());
and on main make comparisions like
if(args[0]=="add")
call add class's method and pass a & b to it
else if(args[0]=="sub")
call sub class's method and pass a & b to it
i think this way your problem got solved