Created
March 25, 2015 18:05
-
-
Save ecornell/cc0d7291c1a649f2cd4e to your computer and use it in GitHub Desktop.
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
/** | |
* Created by ecornell on 3/25/2015. | |
*/ | |
public class Condition { | |
public static void main(String[] args) { | |
char cChoice = 'a'; | |
while (!(cChoice == 'Q' || cChoice == 'q')) { | |
System.out.println("condition 1 - cChoice = 'a' - looping"); | |
break; | |
} | |
while (cChoice != 'Q' || cChoice != 'q') { | |
System.out.println("condition 2 - cChoice = 'a' - looping"); | |
break; | |
} | |
cChoice = 'q'; | |
while (!(cChoice == 'Q' || cChoice == 'q')) { | |
System.out.println("condition 1 - cChoice = 'q' - looping"); | |
break; | |
} | |
while (cChoice != 'Q' || cChoice != 'q') { | |
System.out.println("condition 2 - cChoice = 'q' - looping"); | |
break; | |
} | |
cChoice = 'Q'; | |
while (!(cChoice == 'Q' || cChoice == 'q')) { | |
System.out.println("condition 1 - cChoice = 'Q' - looping"); | |
break; | |
} | |
while (cChoice != 'Q' || cChoice != 'q') { | |
System.out.println("condition 2 - cChoice = 'Q' - looping"); | |
break; | |
} | |
} | |
} | |
// Output | |
// | |
// condition 1 - cChoice = 'a' - looping | |
// condition 2 - cChoice = 'a' - looping | |
// condition 2 - cChoice = 'q' - looping | |
// condition 2 - cChoice = 'Q' - looping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment