fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println(booleanExpression(true, true, true, true));
  13. System.out.println(booleanExpression(true, true, true, false));
  14. System.out.println(booleanExpression(false, false, false, true));
  15. System.out.println(booleanExpression(false, false, false, false));
  16. System.out.println(booleanExpression(true, false, true, false));
  17. }
  18.  
  19. public static boolean booleanExpression(boolean a, boolean b, boolean c, boolean d)
  20. {
  21. if (a && b) return !(c || d);
  22. if (c && d) return !(a || b);
  23. return (a || b) && (c || d);
  24. }
  25. }
Success #stdin #stdout 0.08s 27772KB
stdin
Standard input is empty
stdout
false
false
false
false
true