Java’s Two Kinds of Types

Supplemental reading (not required, but if you’re curious and hungry for more, or you’d like some more traditional reading to supplement the code):

  • primitive types
  • operators
  • limits of int types, overflow
  • boolean value
  • primitive types vs object types
  • method, method call, receiver
  • comparison operators (==) vs. comparison methods (.equals) for strings
  1. Ponder the puzzles at the end of PrimitiveTypes.java. What questions do you have?
  2. What might the AST for this code from the reading look like?

     mascot.repeat(3)
    

    What about this?

     (mascot + "!").repeat(3)
    

    What about this?

     mascot.substring(0, 2).repeat(100)
    

    We haven’t covered this in class yet, or in the readings. Just take a guess! What do you think might make sense? Think about it before class.

  3. What other little experiments can you try on this code?

What was particularly interesting, confusing, or exciting to you in this reading?