public class expresion_condicional {
    static public void main(String args[]) {

        int x =1, y;

        /*
         * La condicional 
        */

        if(x==1) y = 20;
        else y = 10;

        System.out.printf("y = %d\n", y);

        /*
         * se puede escribir como 
         */

        y=0;

        y = (x==1) ? 20 : 10;        
        System.out.printf("y = %d\n", y);

        /*
         *Otro ejemplo es
         */

        if(x==1) System.out.printf("en Auto");
        else System.out.printf("en bici");

        /**
         *Utilizando expresiones
         */

        System.out.printf((x==1) ? "en Auto" : "en bici");
    }
}
