Created
September 4, 2012 23:27
-
-
Save javadabadoo/3628020 to your computer and use it in GitHub Desktop.
Demostracion de como funcionan los operadores logicos en Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
System.out.println("-- -- -- OR -- -- --"); | |
if(bol(1, true) | bol(2, true)); | |
System.out.println(); | |
if(bol(1, false) | bol(2, false)); | |
System.out.println("-- -- -- XOR -- -- --"); | |
if(bol(1, true) || bol(2, true)); | |
System.out.println(); | |
if(bol(1, false) || bol(2, false)); | |
System.out.println("-- -- -- AND -- -- --"); | |
if(bol(1, false) & bol(2, false)); | |
System.out.println(); | |
if(bol(1, true) & bol(2, true)); | |
System.out.println("-- -- -- XAND -- -- --"); | |
if(bol(1, false) && bol(2, false)); | |
System.out.println(); | |
if(bol(1, true) && bol(2, true)); | |
} | |
private static boolean bol(int indice, boolean retorno) { | |
System.out.printf("Imprimiento que el valor de %d es %b%n", indice, retorno); | |
return retorno; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment