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 NetBeans 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

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.”

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 NetBeans 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 NetBeans

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 NetBeans 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 NetBeans skills whenever they’re useful.

Note, however, that we also have an Eclipse 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 NetBeans IDE to code, test, and debug applications. We chose NetBeans 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 NetBeans for free from the NetBeans 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 Eclipse instead of NetBeans?

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

An alternate Java text to consider

It differs from this Beginning Java book in that (1) it goes into more depth and breadth on some subjects, especially GUI and database handling, and (2) it covers up through Java 9 instead of Java 8. It differs, too, from the 4th edition in that we integrated much of what we learned from the Beginning books to make this edition more beginner-friendly.

So you might want to take a look at the table of contents to see if you prefer it to the Beginning Java book. It’s true, you probably won’t be able to cover everything in it unless you offer multiple courses in Java. But by the end of your first course, students will be confident about using the book to learn additional skills on their own…a great resource for those who become professional Java developers.

What people say about this book

“Great book for working with Java and NetBeans. In addition to Java basics, it presents essential Java skills against the core APIs in an easy-to-understand format. “Over the years I have used Eclipse, IntelliJ IDEA, and NetBeans IDEs for projects and have always had a preference for NetBeans due to its ease of use and intuitiveness. This book covers Java in sync with NetBeans by the best means throughout. If you plan on writing any software with Java, consider using the NetBeans IDE as well as referencing/buying this book.” - Robert Liguori, posted at Amazon

“If developers would rather not work through hundreds of pages but would prefer a hands-on experience in which they write small programs that quickly teach the language in a series of graduated projects, then Murach’s Beginning Java is the book I recommend.” - Andrew Binstock, Editor-in-Chief, Java Magazine; from a review in the January/February 2016 issue

“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

“A Must-Have Book for Your Library: I highly recommend this book for any developer, regardless of experience or skill level.” - Posted at Amazon

New features for working with interfaces

The Product Viewer application

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 NetBeans 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 and NetBeans

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 and Netbeans

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!