Journey to Java: Episode 3 “Operators, Expressions, and Conditionals”

3 + 7;
// 3 and 7 are operands
// + is the operator
3 + 7 is the expression
boolean isOverTwentyOne = true;if (isOverTwentyOne == true){
System.out.println("over twenty one");
}
// checking to see if isOverTwentyOne is true then performing a task if it is.
int high = 70;
int low = 20;
int testNum = 55;
if (testNum > low && testNum < high) {
System.out.println("test number is in the middle");
}
char a = "A";
char b = "B";
char newGrade = "A";
if (NewGrade == a || newGrade == b) {
System.out.println("this is a good grade");
}
boolean happy = true;if (happy){
System.out.println("you are happy");
{
if (!happy){
System.out.println("you are not happy");
}
boolean isInvited = trueisInvited ? System.out.println("invited") : System.out.println("not invited");
public class Practice {   public static void main(String[] args) {      //conditional test      double twenty = 20.00;      double eighty = 80.00;      double solution = (twenty + eighty) * 100.00 % 40.00;      boolean divisable = (solution == 0) ? true : false;
if (!divisable) { System.out.println("got some remainder"); } }}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store