// Achtung: dieses Demo funktioniert nur mit int-Zahlen
public class Rechner
{
     static int erg;
     static String Op1;
     static String Op2;
     static String Op3;
     static int Z1;
     static int Z2;

static public void main(String [] args )
{
    if( args.length!= 3 )
    {
        System.out.println(  " usage zahl op zahl  ");
    }
    else
    {
         Op1 = args[0];
         Op2 = args[1];
         Op3 = args[2];
         Z1 = Integer.valueOf(Op1).intValue();
         Z2 = Integer.valueOf(Op3).intValue();

         switch( Op2.charAt(0) ){
             case '+':
             erg = pluss(Z1, Z2);
             break;
             case '/':
             erg = geteilt( Z1, Z2);
             break;
             default:
             System.out.println("Falscher Operator");
             System.exit(0);
             break;
        }
        System.out.println( erg);
    }
}

static int pluss( int x, int y){
    return (x + y );
}

static int geteilt( int x, int y){
    int z = 0;
    try
    {
        z = x / y;
    }
    catch( ArithmeticException e)
    {
        System.out.println(" Division durch Null leider nicht erlaubt");
    }
    return z;
}
}