Created
December 17, 2013 21:50
-
-
Save rogierslag/8013191 to your computer and use it in GitHub Desktop.
Voorbeeld testcase met MiniJava voor Lazy evaluation van een And()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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