We emphasized you need to prepare for minute papers from now on. 

We also emphasized that you need to read before coming to class. 

We then perused the reading assignment and wrote the following programs: \

public class Two {
  public static void main(String[] args) {
    System.out.println( (double) 2 / 3 < 0.5 );
  }
}

This was our minute paper. 

class Nine {
  public static void main(String[] args) {
    String a = "tomato", b = "automaton"; 
    //                        012345678
    System.out.println( a == "tomato" ); // deceivingly enought this comes up as true 
    System.out.println( b.substring(2, 8) ); // tomato 
    System.out.println( a == b.substring(2, 8) ); 
    System.out.println( "tomato" == b.substring(2, 8) ); 
    System.out.println( a.equals( b.substring(2, 8) ) );         
  }
}

This was showing why String equality should not be tested with ==. 

class One {
  public static void main(String[] ags) {
    if (false) {

    }
    
    {
      System.out.println("Howdy.");
    } 
    
    System.out.println("End of program."); 
  }
}

This program was related to Common Error 3.1 (see below): 

class One {
  public static void main(String[] ags) {
    if (false) ; {
      System.out.println("Howdy.");
    } 
    
    System.out.println("End of program."); 
  }
}

The code above and the code before it are equivalent. 

We decided we need to say more about:

(a) the empty statement in Java

(b) anonymous blocks in Java 

Finally we started the problem we wanted to discuss in this lecture. 

We showed it's analogous to P3.28 which is part of your lab assignment. 

Here's the code we wrote:

class Exercise {
  public static void main(String[] args) {
    String a = args[0]; 
    String b = args[1]; 
    String c = args[2];
    System.out.println(a);
    System.out.println(b);
    System.out.println(c);
    
    int x = Integer.parseInt(a);
    int y = Integer.parseInt(b);
    int z = Integer.parseInt(c);
    System.out.println(x + y + z);
    
    if (x + y + z >= 0)  {
      System.out.println("We have a complicated rule with exceptions"); // [1]
    } else  {
      System.out.println("If two numbers are the same we're done."); // [2] 
    }
  }
}

In the code above [1] and [2] are still left to be finished. 

I'll post an interactive template for the finished answer. 

We'll see you in lab. 

--