teaching machines

CS 145 Lecture 4 – Types

September 10, 2014 by . Filed under cs145, fall 2014, lectures.

Agenda

What’s Wrong With This

  1. int a = 5;
    int b = 6;
    int a = 7;

  2. System.out.println("I'm ", 5);

  3. int i = 100 * 0.5;

Code

Declassignments.java

package lecture0910;

public class Declassignments {
  public static void main(String[] args) {
//    int a;
//    System.out.println(a);
    
//    System.out.printf("I'm %d", 5);
    
    System.out.println('\u265b');
    System.out.println('\u2603');
    System.out.println('\u2672');
    System.out.println('\u2697');
    System.out.println('\u266A');
    System.out.println('\u2682');

    byte b = 127;
    short s = b;
    
    b = (byte) s;
    
    int i = (int) (100 * 0.5);
    System.out.println(i);
  }
}

Haiku

on the authoritarian forcing of types:
My dog was meowing
The vet put him in a cast
Now he barks with tears