Module 1, Part 3
Types and Expressions
This part introduces you to the notion of type and discusses Java expressions
constructed using types int, double,
boolean, char, and String. We
talk about function calls and give the precedence of operators.
For a brief introduction to all of these types, read
Gries/Gries, Section 1.1, pp. 15-26.
In general, you should use Chapter 6 of Gries/Gries, pp. 215-229, as a reference
for the various primitive types. Have a question about a type? Try looking (1)
in this chapter, (2) our own online hypertext
glossary,
(3) in the ProgramLive glossary, or (4) Gries/Gries before throwing up your
hands and calling or emailing someone.
Contents
1. Types and type int
Web Lecture
Reading:
Gries/Gries, Sec.1, pp. 15-18.
Lecture Notes
(Lecture Slides)
Comments:
An introduction to the notion of type and Java's type
int.
2. Type char
Reading:
Lecture notes
Gries/Gries, Sec. 6.5, pp. 224-225.
Comments:
A brief introduction to type char, whose values
are single characters.
3. Type double
Reading:
Lecture notes
Gries/Gries, Sec. 6.4, pp. 221-224.
Comments:
Type double is not an important concept in this
course, but you should know a little bit about it because it may
be used in some assignments.
4. Type boolean
Web Lecture
Reading:
Lecture notes
Gries/Gries, Sec. 6.7, pp. 226-229.
Comments:
Type boolean has the values true and
false and operations &&,
||, and !.
5. Type String
Web lecture
Reading:
Lecture notes
Gries/Gries, Sec. 5.2, pp. 175-179.
Comments:
Type String consists of sequences of characters.
6. Function Calls
Web lecture
Reading:
Lecture notes
Gries/Gries, Sec. 2.2.3, p. 62.
Comments:
We show you the basic syntax of function calls and introduce you
to some useful functions. See Gries/Gries, 1.1.
7. Precedence of Operators
Reading:
Online resource
Gries/Gries, p. 227.
Comments:
Some precedences are standard in mathematics; others are not. We show you Java's precedences.
|