Skip to content

Instantly share code, notes, and snippets.

View hpai1989's full-sized avatar

qoopboodqoop hpai1989

View GitHub Profile
@hpai1989
hpai1989 / EECS 132 prelab4
Created September 23, 2013 05:02
prelab 4
//1. Create a variable called test of type boolean and assign the variable the value true.
boolean test = true
//2.Create a variable called a of type int and assign the variable the value 5.
int a = 5
/*3.Type in an if statement that adds 1 to a if test has value true and subtracts 1 from a if test has value false.
Helpful hint: The DrJava interactions pane will evaluate an expression after you hit the return key if what you have typed in is a valid expression. To keep the interactions pane from evaluating your if statement prematurely, either type the entire statement in one line or place the statement inside braces { }*/
if (test == true) {
a + 1;}
else { a - 1;}
//4.Type a to see the current value of a. If you did everything correctly, it should be 6.