6. Data Types

We did a whirlwind tour of Chapter 5 and 6

Chapter 5

Read Section 5.3 - reserved words. Look at Figure 5-1 on page 111 and do not use those words as variable names in your program. Especially try!

Interested in mastering all of Java? Look up the unusual keywords:

Chapter 6

Skim Chapter 6:

  • 6.3: Declaring fields, including the use of final for constant instance variables. Constants are conventionally written in UPPERCASE.
  • 6.4: The Table 6-1 on page 133 shows the size in bytes of each of the built-in types, as well as their range.
  • 6.5: How do you get " inside a string? How about \?
  • 6.6: The section on scope is too brief, but the PowerPoint has good examples.

Read the code below and decide how new Demo(8) will print out?

public class Demo {
   private int num = 1;
   public Demo(int n) {
      int  num = n;
   }
   public String toString { return "Demo: "+num; }
}

Chapter 6 exercises

  • Exercises: 3, 4, 6, 7, 9, 11.
  • Programming: 13.
Last modified August 18, 2023: 2022-2023 End State (7352e87)