Announcements:

(a) Makeup on Wednesday 

(b) Lab Nine, Homework Eight

(c) Homework Nine 

(d) Lab Ten

Minute paper: 

class One {
  public static void main(String[] args) {
    int i = 3;
    int j = 5;

    j = i++ + (1 - ++i); // thanks to Rustam, Phillip and Ling for noticing 
                         // that the order of evaluation is not changed by ()'s

//      3 
// i becomes 4 
//      3   + (1 - 5) and i has become 5 in the process
//      3   + 1 - 5 

//  which makes j -1 and i 5 at this stage

// if we had evaluated j = (1 - ++i) + i++; that would have made j 1 and i 5 
// that would be the way to change the order of evaluation of the two increment expressions involving i

    System.out.println( j ); // -1 

    System.out.println( i ); // 5 

    // i is 5 at this stage

    i = i + 1; // same as i +=1; also same as i++; also same as ++i;
    System.out.println( i ); // i is 6 now

    i = i++;
    System.out.println( i ); // i stays 6

    i = ++i;
    System.out.println( i ); // i becomes 7 and then stays 7

    System.out.println("The exercise: "); 

    i = 3; 
    j = 5; 

    j = i++ - ++i; 

    System.out.println( j ); 
    System.out.println( i ); 

  }
}




























George, Thomas, Abe, Alexander, ...