Skip to content

Instantly share code, notes, and snippets.

@josephkandi
Created May 6, 2016 08:08
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 josephkandi/79bf623bbe09c19698fa801ee0a61abb to your computer and use it in GitHub Desktop.
Save josephkandi/79bf623bbe09c19698fa801ee0a61abb to your computer and use it in GitHub Desktop.
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