Core Version
Comprehensive Version
Introduction to Java Programming, 7E
 
Y. Daniel Liang

Fundamentals First

This book adopts the fundamentals-first and objects-late strategy, proceeding at a steady pace through all the necessary and important basic concepts, then moving to object-oriented programming, and then to the use of the object-oriented approach to build interesting GUI applications and applets with exception handling, and advanced features.

Why Fundamentals First?

Learning basic logic and fundamental programming techniques like loops and step-wise refinement is essential for new programmers to succeed. Students who cannot write code in procedural programming are not able to learn object-oriented programming. A good introduction on primitive data types, control statements, methods, and arrays prepares students to learn object-oriented programming.

From Fundamentals to Object-Oriented

The book is fundamentals-first. Often students have difficulty to adapt to object-oriented paradigm. The book addresses this issue in a new chapter 9 on transition from procedural programming to object-oriented programming. The chapter focuses on class design. Several examples are used to demonstrate the advantages of object-oriented programming. Students learn how and when to apply OOP effectively.

Pedagogical Features

The philosophy of the Liang Java Series is teaching by example and learning by doing. Basic features are explained by example so that you can learn by doing. The book uses the following elements to get the most from the material:

Problem Driven

This book uses the problem-driven approach to teach problem solving. Interesting and practical examples are used not only to illustrate syntax but also to teach problem solving and programming. Interesting and practical problems introduce each chapter and are solved within the chapter. The book uses a wide variety of problems with various levels of difficulty to motivate students. The problems cover many application areas in gaming, math, business, science, animation, and multimedia. Here are some representative problems in the book:

Example 1: We start Chapter 2 with a simple problem for computing the area for a circle given its radius (§2.2, “Writing Simple Programs”). To solve this problem, we introduce variables for storing data and data types for declaring variables. We also introduce expressions for computing area. Initially, the input value for radius is coded in the program. This is not convenient. Later we introduce how to prompt the user to enter data at runtime using the Scanner class (§2.11) and the input dialog box (§2.16).

Example 2: The comparison operators and boolean type are introduced with the AdditionQuiz game (Listing 3.3) that automatically generates an addition question and grades the user answers. Later we introduce the need for a selection statement in the SubtractionQuiz game (Listing 3.4) that automatically generates a subtraction question (i.e., firstNumber – secondNumber) and grades the user answers. Since we require that the first number be greater than the second number, a selection statement must be used to write this program.

Example 3: The SubtractionQuiz game generates just one question. To repeatedly generate random questions, you have to use loops. In Chapter 4, we revise SubtractionQuiz to generate ten questions in SubtractionQuizLoop (Listing 4.3).

Example 4: The GreatestCommonDivisor program (Listing 4.8) computes the greatest common divisor (gcd) of two numbers. This program is not reusable because all the code is in the main method. To make the code modular and reusable, we revise the program to create a method for computing gcd in Listing 5.5.

Example 5: Listing 3.6, ComputeBMI.java, gives a program for computing Body Mass Index. Suppose you want to store the user information. The program is difficult to expand in the procedural paradigm. We redesign the program using classes in §9.6, “Object-Oriented Thinking,” and use this problem to demonstrate the advantages of using the object-oriented paradigm over the procedural paradigm.

Example 6: A new Guess Birth Date game was created for this book. The game is to ask five questions and determines one's birth date in a month. Click here to see how the game is played. There are many games like this throughout the book. We use a wide variety of simple, stimulating, and short examples to motivate students in programming.

Why Problem-Driven?

Programming isn’t just syntax, classes, or objects. It is really problem solving. Loops, methods, and arrays are fundamental techniques for problem solving. From fundamental programming techniques to object-oriented programming, there are many layers of abstraction. Classes are simply a layer of abstraction. Applying the concept of abstraction in the design and implementation of software projects is the key to developing software. The overriding objective of the book, therefore, is to teach students to use many layers of abstraction in solving problems and to see problems in small and in large. The examples and exercises throughout the book emphasize problem solving and foster the concept of developing reusable components and using them to create practical projects.