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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.