fork(3) 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. // Vergleichsoperatoren
  13. int value1 = 1;
  14. int value2 = 2;
  15. if(value1 == value2)
  16. System.out.println("value1 == value2");
  17. if(value1 != value2)
  18. System.out.println("value1 != value2");
  19. if(value1 > value2)
  20. System.out.println("value1 > value2");
  21. if(value1 < value2)
  22. System.out.println("value1 < value2");
  23. if(value1 <= value2)
  24. System.out.println("value1 <= value2");
  25.  
  26. // Logische
  27. if((value1 == 1) && (value2 == 2))
  28. System.out.println("value1 is 1 AND value2 is 2");
  29. if((value1 == 1) || (value2 == 1))
  30. System.out.println("value1 is 1 OR value2 is 1");
  31.  
  32. // Bitoperatoren
  33. int bitmask = 0x000F;
  34. int val = 0x2222;
  35. // prints "2"
  36. System.out.println(val & bitmask);
  37. }
  38. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
value1 != value2
value1 < value2
value1 <= value2
value1 is 1 AND value2 is 2
value1 is 1 OR value2 is 1
2