CHAPTER 0
Introduction to Java
This is a book about programming: specifically, about understanding and using data structures and algorithms. The Java Collections Framework has a considerable number of data structures and algorithms. Subsequent chapters will focus on what the framework is and how to use the framework in your programs. For this information to make sense to you, you will need to be familiar with certain aspects of Java that we present in this chapter. All of the material is needed, either for the framework itself or to enable you to use the framework in your programming projects.
CHAPTER OBJECTIVES
- Learn (or review) the fundamentals of Java, including classes, objects and messages.
- Be able to use javadoc in writing method specifications.
- Incorporate the Scanner class into your programming.
- Understand the significance of the fact that a copy of the argument is stored in the corresponding parameter when a method is called.
- Understand the details of arrays and output formatting.
0.1 Java Fundamentals
Every Java program is a collection of classes. Basically, a class consists of variables, called fields, together with functions, called methods, that operate on those fields. A program is executed when a special method, the main method, is called by the run-time system (also known as the Java Virtual Machine). The heading of this method is fixed, as shown in the following program:
public class HelloWorld { public static void main (String [ ] args) { System.out.println ...
Get Data Structures and the Java Collections Framework, Third Edition 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.