Chapter 3. Types and methods

Types and methods

3.1 Talking about types

3.2 Repetition with for-loops

3.3 Making methods

3.4 Passing parameters and returning results

3.5 Typed methods

3.6 The type boolean

3.7 Case Study 1: Pizza Delivery 2U

Talking about types

Having examined integer numbers in Section 2.4, we now continue our discussion of types. Java has six numeric types – int, long, double, byte, short and float – which we shall consider first, and two special types, boolean and char, which we shall look at later. When considering the numeric types, we raise the issue of how to convert from one to the other, so that assignments can be made between variables of different ...

Get Java Gently, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.