2

Data Types

Contents

  • Basic data types, their uses and limitations
  • Abstract data types
2.1 INTRODUCTION

This short chapter introduces the basic ‘primitive’—fundamental and in-built—types in Java and discusses their limitations. We also encounter an ‘abstract data type’ as part of the process of specifying additional ones—the structures with which this book is concerned.

2.2 DATA TYPES AND VARIABLES

When a variable is declared in a program, its type defines the kind of data and the range of values that it may contain. All programming languages have some ‘predefined’ data types. Figure 2.1 shows some of these for the Java language.

2.2.1 Operations on integers

Operators for variables of integer type are as follows:

  • assignment of values (=) ...

Get Introducing Data Structures with Java now with O’Reilly online learning.

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