home *** CD-ROM | disk | FTP | other *** search
/ Java Certification Exam Guide / McGrawwHill-JavaCertificationExamGuide.iso / pc / Web Links and Code / code / chap6 / Xor.java < prev   
Encoding:
Java Source  |  1997-04-19  |  377 b   |  16 lines

  1. class Xor {
  2.    public static void main(String[] args) {
  3.       boolean t1 = true;
  4.       boolean t2 = true;
  5.       boolean f1 = false;
  6.       boolean f2 = false;
  7.  
  8.       if (t1 ^ t2)
  9.          System.out.println("both are true");
  10.       if (t1 ^ f1)
  11.          System.out.println("one is true");
  12.       if (f1 ^ f2)
  13.          System.out.println("neither are true");
  14.    }
  15. }
  16.