fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.Scanner;
  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. Scanner sc = new Scanner(System.in);
  13. boolean n,m;
  14. System.out.println("enter the value of n:");
  15. n = sc.nextBoolean();
  16. System.out.println("enter the value of m:");
  17. m = sc.nextBoolean();
  18. System.out.println("the OR of two no. is" + (n|m));
  19. System.out.println("the XOR of no. is" + (n^m));
  20. System.out.println("And Gate is " + (n&m));
  21. }
  22. }
Success #stdin #stdout 0.07s 2184192KB
stdin
True False
stdout
enter the value of n:
enter the value of m:
the OR of two no. istrue
the XOR of no. istrue
And Gate is false