Skip to content

Instantly share code, notes, and snippets.

@rogierslag
Created December 17, 2013 21:50
Show Gist options
  • Save rogierslag/8013191 to your computer and use it in GitHub Desktop.
Save rogierslag/8013191 to your computer and use it in GitHub Desktop.
Voorbeeld testcase met MiniJava voor Lazy evaluation van een And()
/**
Produceert output
0
*/
class Rogier {
public static void main(String[] args) {
if( false && (new AA()).bool() ) {
System.out.println(4);
} else {
System.out.println(0);
}
}
}
class AA {
public boolean bool() {
System.out.println(405934);
return true;
}
}
/**
Produceert output
405934
4
*/
class Rogier {
public static void main(String[] args) {
if( true && (new AA()).bool() ) {
System.out.println(4);
} else {
System.out.println(0);
}
}
}
class AA {
public boolean bool() {
System.out.println(405934);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment