Created
May 6, 2016 08:08
-
-
Save josephkandi/79bf623bbe09c19698fa801ee0a61abb 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
class BooleanDemo { | |
public static void main (String[] args) { | |
//boolean type hold the value of either true or false | |
boolean loggedIn = true; | |
System.out.println("loggedIn " + loggedIn); | |
//when using boolean types, the convention is to use is before the variable name | |
boolean isAuthenticated = false; | |
System.out.println("isAuthenticated " + isAuthenticated); | |
//boolean types are used in conditional statements | |
//The double equals(==) checks for equality. We will cover the if statement later on | |
if(isAuthenticated == true){ | |
System.out.println("I am auntenticated"); | |
}else { | |
System.out.println("I am not auntenticated"); | |
} | |
//TODO | |
//Change the isAuthenticated to false | |
//And change the order of the expression in the if statement so that it outputs the right message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment