Skip to content

Instantly share code, notes, and snippets.

@erikbgithub
Created July 13, 2009 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikbgithub/146072 to your computer and use it in GitHub Desktop.
Save erikbgithub/146072 to your computer and use it in GitHub Desktop.
public class ShowIf {
public void printWay(boolean A, boolean B) {
if(A) {
System.out.println("A is true, but B is not");
}
if(B) {
System.out.println("B is true, but A is not");
}else{
System.out.println("Both A and B aren't true");
}
//just for some good lucking space between outputs
System.out.println();
}
public static void main(String[] args) {
ShowIf sut = ShowIf();
sut.printWay(true, true);
sut.printWay(true, false);
sut.printWay(false, true);
sut.printWay(false, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment