Skip to content

Instantly share code, notes, and snippets.

@dhust
Last active May 23, 2017 00:20
Show Gist options
  • Save dhust/6134922 to your computer and use it in GitHub Desktop.
Save dhust/6134922 to your computer and use it in GitHub Desktop.
Operators - && (AND)
public static void main(String[] args) {
int a = 14;
if ( (a > 0) && (a < 10) ) {
System.out.println("a is between 0 and 10.");
}
else if (a >= 10 && a < 20) {
System.out.println("a is between 10 and 20, including 10.");
}
else {
System.out.println("a is less than 0 or greater than 20, including 0 and 20.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment