FileDocCategorySizeDatePackage
BooleanAndOr.javaAPI DocExample1039Sat Nov 25 12:55:38 GMT 2000None

BooleanAndOr

public class BooleanAndOr extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] a)

		String s = null;

		// These use the conventional logical "and" (&&) and "or" (||).
		try {
			if ((s != null) && (s.length() > 0))
				System.out.println("At Point One");
			if ((s != null) || (s.length() > 0))
				System.out.println("At Point Two");
		} catch (Exception e) {
			System.out.print("Logical section threw ");
			e.printStackTrace();
		}

		// These use bitwise "and" (&) and "or" (|); is it valid? What results?
		try {
			if ((s == null) & (s.length() > 0))
				System.out.println("At Point Three");
			if ((s == null) | (s.length() > 0))
				System.out.println("At Point Four");
		} catch (Exception e) {
			System.out.print("Bitwise section threw ");
			e.printStackTrace();
		}