Skip to main content

more options

Part 2. Integrated dev. envs.    Part 4. Variables, declarations, assignments

Module 1, part 3. Types and expressions

Introduction

This part 3 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. The reading for this part is Gries/Gries, Section 1.1, pp. 15-26.

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

No. Topic Discussion
1. Types and type int.
(blecture ppt.pdf)
Reading: Gries/Gries, Sec.1, pp. 15–18.
An introduction to the notion of type and Java's type int.
2. Type char (html) A brief introduction to type char, whose values are single characters.
3. Type double (html) 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
(blecture  doc java)
Type boolean has the values true and false and operations &&, ||, and !.
5. Type String
(blecture  doc java)
Type String consists of sequences of characters.
6. Function calls
(blecture  doc  java)
We show you the basic syntax of function calls and introduce you to some useful functions. See Gries/Gries,
7. Precedence of operators (html) Some precedences are standard in mathematics; others are not. We show you Java's precedences.
  Reading, all in Gries/Gries. For brief introductions to types double, boolean, and String, as well as to function calls and precedence of operators, see pp. 18–24. For more thorough references, see the sections in the next column. Type char: Sec. 6.5, pp. 224–225.
Type double: Sec. 6.4, pp. 221–224.
Type boolean: Sec. 6.7, pp. 226–229.
Type String: Sec. 5.2, pp. 175–179.
Function calls: Sec. 2.2.3, p. 62.
Precedence of operators: p. 227.