Customer Service 1-800-221-5528

Murach’s Beginning Java with Eclipse

by Joel Murach and Michael Urban
22 chapters, 660 pages, 263 illustrations
Published August 2015
ISBN 978-1-890774-89-9
List price: $57.50

For years, Murach’s Java Programming has been one of our best-selling college books...but its fast pace can make it a challenging book for beginners. That’s why we designed Murach’s Beginning Java with Eclipse specifically for a first course in programming or a first course in Java.

Like Murach’s Java Programming, we expect our Beginning Java book to become a favorite of instructors and students because of the clear, concise way it teaches Java and OO programming. Beyond that, though, this new book has didactic features that make it much more effective for beginners.

Buy this book

You are currently on the Murach site for instructors. To buy this book, please visit our retail site.

At long last, a Java book written with understandable text, ready-to-run code, and some of the best exercises in print! This book has a no-nonsense style, with an expert perspective on the big picture.”

Donna M. Dean, Senior Technical Instructor, on an earlier edition of our other Java book, Murach’s Java Programming

  • About this Book
  • Table of Contents
  • Courseware
  • FAQs
  • Corrections

What this book does

Section 1: Get your students started right

Section 1 presents a 6-chapter Java course that gets your students off to a great start. This section works for a first course in programming or in Java because it lets you set the right pace. For a first programming course, you can have your students move slowly and do all the exercises. For a first Java course, they’ll move more quickly and do the exercises that you select.

From the start, your students will be using the Eclipse IDE because that will help them learn faster. Then, by chapter 3, they’ll be developing applications that use classes from the Java API. By chapter 4, they’ll be creating and using their own classes. By chapter 5, they’ll be using a 3-tier architecture to structure object-oriented applications like a professional. And by chapter 6, they’ll be using the best practices for testing and debugging their applications.

Once your students master the skills of section 1, the hard work is done. Then, you can add to their core skills by covering the chapters in sections 2, 3, and 4. At that point, they’ll have all the Java prerequisites they need for web or Android courses.

And if you have time, you can give them a good look at the real world of Java programming by using section 5. This section introduces them to coding desktop applications using Swing to create GUI interfaces and using MySQL to handle database data.

Section 2: The essential core Java skills

In section 2, your students will expand upon what they learned in section 1 by mastering more of the core Java skills that they’ll use all the time. That means that they’ll learn new skills, like how to work with strings and arrays. But they’ll also learn more about topics that were introduced in section 1, like working with primitive types and operators and coding control statements. These are the essentials that your students need for section 3.

Section 3: Object-oriented programming made clear

In section 1, your students learned how to develop their first object-oriented programs. Now, after section 2, they have the core skills for learning more about OOP.

Then, section 3 cuts through the mysteries of inheritance, interfaces, polymorphism, and the factory pattern so your students learn how to create and use more sophisticated business and data access classes. When your students finish this section, they will know how to develop real-world, object-oriented, business applications.

Section 4: The rest of the core Java skills

Like section 2, section 4 lets your students expand their core Java skills in new ways. To be specific, it covers how to work with collections, generics, lambdas, dates, times, exceptions, file I/O, and threads. However, because each chapter in this section is an independent module, you don’t have to assign these chapters in sequence and you don’t have to assign all of them. Instead, you can use the sequence and content that works best for your class.

Section 5: Real-world GUI and database programming

When your students complete sections 1-4, they will have all the perquisite Java skills they need for courses on Java web programming, Android programming, or advanced Java. But there’s a bonus section!

The 4 chapters in section 5 are designed to give your students a better appreciation for what real-world programming is like. As a result, they introduce your students to the skills for developing desktop applications. To start, these chapters show how to create a MySQL database and how to write the Java code that works with the data in this database. Then, these chapters show how to develop a graphical user interface (GUI) for the application.

Of course, you don’t have to assign the chapters in this section. You can also assign them as information only: no exercises. But we think that this section will provide an aha! moment for many students, showing them where their Java skills can take them… and that’s important in any first programming course.

Why this book will help your students learn faster and better

Like all of our books, this one has the distinctive features that make Murach books so effective. But here are a few of the benefits that are specific to this book:

Your students are supported through the learning curve

For the past 13 years, we’ve often had true beginners tell us that they like our Java book overall, but they also find it overwhelming at times. (As one reviewer of the first edition put it, “It’s not for the faint of heart!”) Students and would-be professionals alike have requested more explanation of certain topics, more examples, and a more relaxed pace.

So that’s what Murach’s Beginning Java delivers:

  • We’ve taken a hard look at the way we present material in Murach’s Java Programming and rearranged topics with beginners in mind.
  • We’ve introduced object-oriented programming earlier so that the OOP mindset becomes natural right at the start.
  • We’ve added more explanation on core programming concepts, like working with classes, numbers, strings, and control structures.
  • We’ve slowed the pace some, breaking the material down into shorter chapters that are easier to master.
  • We’ve added more examples to guide beginners through the code and more exercises to let them practice what they’ve learned.

In short, we now have the ideal book for your students who are taking their first courses in programming and Java.

Your students will take full advantage of Eclipse

Unlike many Java books, this book shows how to use an IDE for developing Java applications. That’s how Java programming is done in the real world because an IDE is loaded with time-saving development tools. So that by itself will help your students learn faster.

For this book, we’ve chosen the Eclipse IDE because it’s free, widely used, and easy for beginners to get started with. Then, chapter 1 shows the basics of using this IDE, and subsequent chapters present new Eclipse skills whenever they’re useful.

Note, however, that we also have an NetBeans version of this book. So if you prefer to use that IDE, please get a review copy of that book. The only difference between the two books is the IDE.

Your students will learn OOP from the start

Unlike many Java books, this one gets you going with object-oriented programming (OOP) from the start (call it “early objects”). By chapter 3, your students will be developing applications that use the classes from the Java API. By chapter 4, they’ll be creating and using their own classes. And by chapter 5, they’ll be using a 3-tier architecture to structure their object-oriented applications the way professionals do.

From that point on, your students will be doing and thinking objects throughout the rest of the book.

Your students will learn the skills that they need on the job

Unlike many Java books, this one focuses on the core Java features that are needed every day on the job. As a result, it doesn’t waste your students’ time by presenting skills that they probably won’t ever need.

This also means that all of the examples in this book are drawn from real-world applications. This is especially apparent in the object-oriented chapters, where most competing books resort to “animal”, “vehicle”, and “toy” applications that misrepresent what OOP is really like.

Your students will learn all of the prerequisite Java skills that they need for web and Android programming

One of the goals of this book is to present all of the Java skills that your students will need to start learning web and Android programming. That’s why we made sure that this book covers all the prerequisites that are needed for Murach’s Java Servlets and JSP (our Java web programming book) and Murach’s Android Programming.

But regardless of what web programming or Android book you use, we haven’t seen another beginning Java book that prepares students so thoroughly for advanced courses.

What software your students need

Java SE 8 is the current version of Java and the one that this book shows how to use. However, since all versions of Java are backwards compatible, the code and skills presented in this book will work with later versions too.

As you can tell from its title, this book shows how to use the Eclipse IDE to code, test, and debug applications. We chose Eclipse because we think it’s a great tool that is easy for beginners to use and runs on all operating systems.

Your students can download Java and its documentation for free from the Oracle website. Likewise, they can download Eclipse for free from the Eclipse website. To make this easier, Appendix A (for Windows) and Appendix B (for the Mac) explain the procedures that they will use to download and install both pieces of software.

Want to use NetBeans instead of Eclipse?

If you prefer to use NetBeans for your Java course, please note that we have an NetBeans version of this book called Murach’s Beginning Java with NetBeans. The only difference between that book and this one is the IDE.

What people say about this book

“This is a great book for someone new to programming or just new to the Java language.
     “The authors slowly walk the reader through the basics: what Java is, OO basics, how to use an IDE, and how to test and debug. The core Java constructs are covered: control statements (if/else, loops and exception handling), strings and arrays. Proper detail is given to key concepts needed to work with Java, including inheritance, how to use collections, and working with lambdas. [And] the book does a complete job instructing the reader on how to use the free and open source IDE, Eclipse.”
- Erik Weibust, Java MUG (Metroplex Users Group)

“I really liked the intro including types of applications and keywords. I liked the covering Eclipse as needed for specific concepts, including perspectives, code completion, and the debugger. Similarly, good programming idioms are covered so readers can see patterns. I particularly liked how the code listings highlight the relevant parts.”
     “Great for learning both Java and your first IDE.”
- Jeanne Boyarsky, JavaRanch.com

“At the end of every chapter, there are a set of hands-on exercises that let you practice the concepts in that chapter. So many other books either don't have practice problems at all, or if they do, they are so open-ended and time-consuming that it is hard to know if you got them right. Murach provides practice code that you download from their website. The problems typically involve using the IDE to make simple code modifications, and then running and debugging your changes. This is an important hands-on approach, since it is not enough to learn a new language just by reading about it.”
- Bruce Alspaugh, St. Louis Java Users Group

“The text rightly uses console applications to focus on the actions described in code. Creating a user interface takes a back seat and is only discussed in the last two chapters, which keeps the focus on the Java code itself. Too many introductory texts focus on the UI at the expense of the code. A great beginner’s text for learning Java.”
- Eric Notheisen, Enterprise Developers Guild

View the table of contents for this book in a PDF: Table of Contents (PDF)

Click on any chapter title to display or hide its content.

Section 1 Get started right

Chapter 1 An introduction to Java programming

An overview of Java

Java timeline

Java editions

How Java compares to C++ and C#

Types of Java applications

Two types of desktop applications

Two types of web applications

Mobile apps

An introduction to Java development

The code for a console application

How Java compiles and interprets code

Introduction to IDEs for Java development

An introduction to Eclipse

How to select a workspace

How to import a project into a workspace

How to open a file in the code editor

How to compile and run a project

How to enter input for a console application

How to work with two or more projects

How to remove a project from a workspace

Chapter 2 How to start writing Java code

Basic coding skills

How to code a class

How to code a main method

How to code statements

How to code comments

How to print output to the console

How to use Eclipse to work with a new project

How to create a new project

How to create a new class

How to work with Java source code and files

How to use the code completion feature

How to detect and correct syntax errors

How to work with numbers

How to declare and initialize variables

How to assign values to a variable

How to code arithmetic expressions

How to work with strings

How to declare and initialize String variables

How to join strings

How to include special characters in strings

The Code Tester application

The user interface

The CodeTesterApp class

Chapter 3 How to use classes and methods

How to work with classes, objects, and methods

How to import classes

How to create an object from a class

How to call a method from an object

How to call a method from a class

How to view the documentation for the Java API

How to work with the console

How to use the Scanner class to get input

How to convert strings to numbers

A class that reads input from the console

How to convert numbers to formatted strings

A class that prints formatted numbers to the console

How to code simple control statements

How to compare numbers

How to compare strings

How to code a while loop

How to code an if/else statement

The Line Item application

The user interface

The code

The Future Value application

The user interface

The code

Chapter 4 How to code your own classes and methods

An introduction to classes

How encapsulation works

The relationship between a class and its objects

How to work with a class that defines an object

The Product class

How to code instance variables

How to code constructors

How to code methods

How to create an object from a class

How to call the methods of an object

How to work with static fields and methods

The ProductDB class

How to code and call static fields and methods

When to use static fields and methods

The Product Viewer application

The user interface

The ProductApp class

More skills for working with classes and methods

Reference types compared to primitive types

How to overload methods

How to use the this keyword

The Product class with overloading

Chapter 5 How to structure an object-oriented application

How to use the three-tier architecture

How the three-tier architecture works

How to work with packages

How to use Eclipse to work with packages

The Line Item application

The user interface

The class diagram

The LineItem class

The LineItemApp class

Chapter 6 How to test and debug an application

Basic skills for testing and debugging

Typical test phases

The three types of errors

Common Java errors

How to determine the cause of an error

A simple way to trace code execution

How to use Eclipse to debug an application

How to set and remove breakpoints

How to step through code

How to inspect variables

How to inspect the stack trace

Section 2 Essential skills as you need them

Chapter 7  How to work with primitive types and operators

Basic skills for working with data

The eight primitive data types

How to declare and initialize variables

How to declare and initialize constants

How to code arithmetic expressions

How to use the binary operators

How to use the unary operators

How to use the compound assignment operators

How to work with the order of precedence

How to work with casting

How to use Java classes to work with numbers

How to use the Math class

How to use the BigDecimal class

How to fix rounding errors

The Invoice application

The user interface

The code

Chapter 8  How to code control statements

How to code Boolean expressions

How to compare primitive data types

How to use the logical operators

How to code if/else and switch statements

How to code if/else statements

How to code switch statements

A new if/else statement for the Invoice application

How to code loops

How to code while loops

How to code do-while loops

How to code for loops

How to code break and continue statements

How to code try/catch statements

How exceptions work

How to catch exceptions

The Future Value application

The user interface

The code

Chapter 9 How to work with strings

How to work with the String class

How to create strings

How to join strings

How to append data to a string

How to compare strings

How to work with string indexes

How to modify strings

How to work with the StringBuilder class

How to create a StringBuilder object

How to append data to a string

How to modify strings

The Product Lister application

The user interface

The StringUtil class

The Main class

Chapter 10 How to work with arrays

Essential skills for working with arrays

How to create an array

How to assign values to the elements of an array

How to use for loops with arrays

How to use enhanced for loops with arrays

How to work with two-dimensional arrays

How to use the Arrays class

How to fill an array

How to sort an array

How to search an array

How to create a reference to an array

How to copy an array

How to compare two arrays

The Month Selector application

The user interface

The Main class

Section 3 Object-oriented programming skills

Chapter 11 How to work with inheritance

An introduction to inheritance

How inheritance works

How the Object class works

Basic skills for working with inheritance

How to create a superclass

How to create a subclass

How polymorphism works

The Product application

The console

The Product, Book, and Software classes

The ProductDB class

The ProductApp class

More skills for working with inheritance

How to cast objects

How to compare objects

How to work with the abstract and final keywords

How to work with the abstract keyword

How to work with the final keyword

Chapter 12 How to work with interfaces

An introduction to interfaces

A simple interface

Interfaces compared to abstract classes

Basic skills for working with interfaces

How to code an interface

How to implement an interface

How to inherit a class and implement an interface

How to use an interface as a parameter

How to use inheritance with interfaces

New features for working with interfaces

How to work with default methods

How to work with static methods

The Product Viewer application

The console

The ProductReader interface

The ProductDB class

The ProductApp class

Chapter 13 How to work with inner classes, enumerations, and documentation

How to work with inner classes

An introduction to GUI programming

How to code an inner class

How to code an anonymous class

How to work with enumerations

How to declare an enumeration

How to use an enumeration

How to enhance an enumeration

How to work with static imports

How to document a class

How to add javadoc comments to a class

How to use HTML and javadoc tags in javadoc comments

How to use Eclipse to generate documentation

How to view the documentation

Section 4 More essential skills as you need them

Chapter 14 How to work with collections, generics, and lambdas

An introduction to Java collections

A comparison of arrays and collections

An overview of the Java collection framework

An introduction to generics

How to use the ArrayList class

How to create an array list

How to add and get elements

How to replace, remove, and search for elements

How to store primitive types in an array list

The Invoice application

The user interface

The Invoice class

The InvoiceApp class

How to work with lambda expressions

An introduction to lambdas

A method that doesn’t use a lambda expression

A method that uses a lambda expressions

How to use the Predicate interface

Chapter 15 How to work with dates and times

An introduction to date/time APIs

The date/time API prior to Java 8

The date/time API for Java 8 and later

How to use the new date/time API

How to create date and time objects

How to get date and time parts

How to compare dates and times

How to adjust date/time objects

How to add or subtract a period of time

How to format dates and times

An Invoice class that includes an invoice date

Chapter 16 How to handle exceptions

An introduction to exceptions

The exception hierarchy

How exceptions are propagated

How to work with exceptions

How to use the try statement

How to use the try-with-resources statement

How to use the methods of an exception

How to use a multi-catch block

How to use the throws clause

How to use the throw statement

How to work with custom exception classes

How to create your own exception class

How to use exception chaining

Chapter 17 How to work with file I/O

An introduction to directories and files

A package for working with directories and files

Code examples that work with directories and files

An introduction to file input and output

How files and streams work

A file I/O example

How to work with I/O exceptions

How to work with text files

How to connect a character output stream to a file

How to write to a text file

How to connect a character input stream to a file

How to read from a text file

A class that works with a text file

The Product Manager application

The console

The Main class

Chapter 18 How to work with threads

An introduction to threads

How threads work

Typical uses for threads

Classes and interfaces for working with threads

The life cycle of a thread

Two ways to create threads

Constructors and methods of the Thread class

How to extend the Thread class

How to implement the Runnable interface

How to synchronize threads

How to use synchronized methods

When to use synchronized methods

Section 5 Real-world skills

Chapter 19 How to work with a MySQL database

How a relational database is organized

How a table is organized

How the tables in a database are related

How the columns in a table are defined

An introduction to MySQL

What MySQL provides

Ways to interact with MySQL

How to open a database connection

How to enter and execute a SQL statement

A SQL script that creates a database

How to drop, create, and select a database

How to create a table and insert data

How to create a user and grant privileges

The SQL statements for data manipulation

How to select data from a table

How to insert, update, and delete rows

Chapter 20 How to use JDBC to work with databases

How to work with JDBC

An introduction to database drivers

How to connect to a database

How to return a result set and move the cursor through it

How to get data from a result set

How to insert, update, and delete data

How to work with prepared statements

Two classes for working with databases

The DBUtil class

The ProductDB class

Code that uses the ProductDB class

Chapter 21 How to develop a GUI with Swing (part 1)

An introduction to GUI programming

A summary of GUI toolkits

The inheritance hierarchy for Swing components

How to create a GUI that handles events

How to display a frame

How to add a panel to a frame

How to add buttons to a panel

How to handle a button event

How to work with layout managers

A summary of layout managers

How to use the FlowLayout manager

How to use the BorderLayout manager

How to work with tables

How to create a model for a table

The ProductTableModel class

How to create a table

How to get the selected row or rows

How to add scrollbars to a table

How to work with built-in dialog boxes

How to display a message

How to confirm an operation

The Product Manager frame

The user interface

The ProductManagerFrame class

Chapter 22 How to develop a GUI with Swing (part 2)

How to work with labels and text fields

How to work with labels

How to work with text fields

How to use the GridBagLayout manager

An introduction to the GridBagLayout manager

How to lay out components in a grid

How to add padding

How to avoid a common pitfall

How to code a data entry form

How to create a custom dialog

How to pass data between a dialog and its parent

The Product form

The user interface

The ProductForm class

Two methods that use the ProductForm class

How to use threads with Swing

A common problem

How to solve the problem

Appendix

Appendix A How to set up Windows for this book

How to install the JDK

How to install Eclipse

How to install the source code for this book

How to install MySQL and MySQL Workbench

How to create the database for this book

How to restore the database for this book

Appendix B How to set up Mac OS X for this book

How to install the JDK 

How to install Eclipse

How to install the source code for this book

How to install the MySQL Community Server

How to install MySQL Workbench

How to create the databases for this book

How to restore the databases

How to update the password for the root user

If you aren’t already familiar with the supporting courseware that we provide for a book, please go to About our Courseware. As you will see, our courseware consists of the end-of-chapter activities in the book, the files in the student download at our retail site, and the instructor’s materials. These components provide everything that other publishers provide in a way that delivers better results.

If you are familiar with our courseware, here’s a quick summary of the courseware for this book. For a detailed description in PDF format, please read the Instructor’s Summary.

End-of-chapter activities in the book

  • Terms lists
  • Chapter summaries
  • Practice exercises

Student download at our retail site

  • Source code and data for the applications in the book
  • Starting code and data for the exercises
  • Solutions to the book exercises

In the book, appendix A (for Windows) and appendix B (for Mac) give your students complete instructions for downloading and installing these items on their own systems.

Instructor’s materials

  • Instructional objectives by chapter
  • PowerPoint slides for classroom presentations
  • Test banks in multiple formats
  • Additional chapter exercises that aren’t in the book, plus their solutions
  • Student projects and model solutions
  • The files that your students can download at our retail site: (1) the book applications, (2) starting points for the exercises in the book, and (3) solutions to the exercises in the book

On this page, we’ll be posting answers to the questions that come up most often about this book. So if you have any questions that you haven’t found answered here at our site, please e-mail us. Thanks!

To view the corrections for this book in a PDF, just click on this link: View the corrections

Then, if you find any other errors, please email us so we can correct them in the next printing of the book. Thank you!

Murach college books and courseware since 1974