Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleExample - Operator precedence


Code Block
consume {
    boolean a = false;
    boolean b = false;
    boolean c = true;
    boolean x;
    // The following statement will be parsed as 
	// false && (false || true)
    // and evaluate to false
    x = a && b || c;
    debug(x);
    // This will evaluate to true
    x = (a && b) || c;
    debug(x);
}



Note
titleJava and APL may differ

In some circumstances,  APL and Java are handling numeric values differently.  APL may be automatically expanded to avoid overflow, this applies also to constant expressions.

Example 1: A statement like: long x=1000000000000; is ok in APL, but will not compile in Java.

Example 2: An expression like: long x=1000000*1000000; works as expected in APL. But in Java, it would assign x to the value -727379968, due to overflow.


Scroll ignore
scroll-viewportfalse
scroll-pdftrue
scroll-officefalse
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmlfalse


Next chapter: