Created
November 9, 2015 14:37
-
-
Save OOPUniversity/65468eabb9134a89e0e9 to your computer and use it in GitHub Desktop.
Demonstration code for the blog post 'If I, if I, if I, if I Didn't Love you else I'd Hate You'
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
/* | |
* Copyright (c) 2014. | |
*/ | |
package main.java.com.oopuniversity.basics.conditionals; | |
/** | |
* Created by OOPUniversity on 12/2/2014. | |
*/ | |
public class IfDemo { | |
public static void main(String[] args) { | |
IfDemo ifDemo = new IfDemo(); | |
ifDemo.trueDemo(); | |
ifDemo.falseDemo(); | |
ifDemo.ifElseDemo(); | |
} | |
void trueDemo() { | |
if (true) { | |
System.out.println("Condition was true."); | |
} | |
} | |
void falseDemo() { | |
if (false) { | |
System.out.println("Condition was false."); | |
} | |
} | |
void ifElseDemo() { | |
boolean condition = true; | |
if (condition == true) { | |
System.out.println("Condition was true."); | |
} | |
else { | |
System.out.println("Condition was false."); | |
} | |
condition = false; | |
if (condition == false) { | |
System.out.println("Condition was true."); | |
} | |
else { | |
System.out.println("Condition was false."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment