My Cart (0)

Customer Service 1-800-221-5528

Murach's Beginning Java with NetBeans

by Joel Murach and Michael Urban
22 chapters, 660 pages, 263 figures
Published June 2015
ISBN 978-1-890774-84-4
eBook: $52.50

We’ve designed Murach’s Beginning Java with NetBeans specifically for beginning programmers and programmers with limited experience who want to learn Java at a professional level. By the time you finish this book, you’ll have all the core Java skills that you need to move on to web or Android programming.

College Instructors

Go to our instructor's site to learn more about this book and its instructor's materials.

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

  • About this Book
  • Table of Contents
  • FREE Downloads
  • Book FAQs
  • Corrections
  • Reviews

What this book does

Section 1: Get started right

Section 1 presents a 6-chapter Java course that gets you off to a great start. This section works for complete beginners as well as experienced programmers because it lets you set your own pace. If you’re a beginner, you’ll move slowly and do all the exercises. If you have some experience, you’ll move more quickly and do the exercises that you choose.

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

Section 2: Expand your core Java skills

In section 2, you’ll expand upon what you learned in section 1 by mastering more of the core Java skills that you’ll use all the time. That means you’ll learn new skills, like how to work with strings and arrays. But you’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 you need for section 3.

Section 3: Object-oriented programming made clear

This book has you creating simple object-oriented programs right from the start in section 1. Then, section 3 cuts through the mystery of inheritance, interfaces, polymorphism, and the factory pattern so you can learn how to create and use sophisticated business and data access classes. When you finish this section, you’ll know how to develop real-world, object-oriented, business applications.

Section 4: Take your core skills to the next level

Like section 2, section 4 lets you expand your core Java skills in new ways. To be specific, it teaches you how to work with collections, generics, lambdas, dates, times, exceptions, file I/O and threads. Because each chapter in this section is independent of the others, you can add these skills to your resume whenever you need them.

Section 5: Real-world GUI and database programming

When you complete sections 1-4, you’ll have all the Java skills you need to start learning web and Android programming. But there’s more!

The 4 chapters in section 5 introduce you to the skills that a professional Java programmer uses to develop desktop applications. To start, these chapters show you how to create a MySQL database for an application 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.

These chapters are designed to give you a better appreciation for what real-world Java programming is like, whether that be desktop, web, or Android programming. That, in turn, will help you decide what to learn next to build your Java career.

Why you will 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:

You get all the help you need to master 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!”) They’ve requested more explanation of certain topics, more examples, and a more relaxed pace.

So that’s what Murach’s Beginning Java delivers. We took a hard look at the way we present material in Murach’s Java Programming and rearranged topics with beginners in mind. We introduced object-oriented programming earlier so that the OOP mindset would become natural right at the start. We added more explanation on core programming concepts, like working with classes, numbers, strings, and control structures. We slowed the pace some, breaking the material down into shorter chapters that would be easier to master. We 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 you if you’re new to programming and Java.

You take full advantage of the NetBeans IDE

Unlike many Java books, this book shows you 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 you learn faster.

For this book, we’ve chosen the NetBeans IDE because it’s free, widely used, and easy for beginners to set up and use. So chapter 1 shows you how to get started with this IDE, and subsequent chapters present new NetBeans skills whenever they’re useful.

You learn OOP from the start

Unlike many Java books, this one gets you going with object-oriented programming (OOP) from the start. By chapter 3, you’ll be developing applications that use the classes from the Java API. By chapter 4, you’ll be doing object-oriented programming with your own classes. And by chapter 5, you’ll be using a 3-tier architecture to structure your object-oriented applications like a professional.

That means that you’ll be using and thinking objects from the start...the way Java was designed to be used.

You learn the skills that you will need on the job

Unlike many Java books, this one focuses on the Java features that you will use every day on the job. As a result, it doesn’t waste your time by presenting Java features that you 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 unrealistic examples that are difficult to apply on the job.

You learn all of the prerequisite Java skills that you need for web and Android programming

One of the goals of this book is to present all of the core Java skills that you need to start learning Java web programming and Android programming. That’s why we made sure that this book covers all the prerequisites you need for Murach’s Java Servlets and JSP (our Java web programming book) and Murach’s Android Programming. But regardless of what Java book or course you go on to, we haven’t seen another beginning Java book that prepares you so thoroughly.

Who this book is for

This book is for anyone who wants to learn the core features of the Java language, especially the features that you need to learn web or Android programming. It is especially designed for those:

  • who have no programming experience at all
  • who have limited programming experience with another language
  • who have already read 3 or 4 other Java books and still don’t know how to develop a real-world application

If you want to go into Android programming or Java web development…

This book is perfect for developers who are moving into programming Android apps or Java web applications. The first four sections deliver the core Java skills that you need, whether you’re looking for a refresher or a first course in Java.

What software you 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 you how to use the NetBeans IDE to code, test, and debug applications. It’s a great tool for beginners that’s easy to use, free, popular, and that runs on all operating systems.

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

If you already have experience with Eclipse or want to use it instead, 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.

Companion books for web and Android developers

Since web programming is one of the primary uses of Java, we also offer a book on web programming called Murach’s Java Servlets and JSP (3rd Edition). It shows you how to use Java servlets and JavaServer Pages as you develop professional web applications. As you read that book, you’ll discover that Java web programming requires most of the skills that are presented in sections 1-4 of Murach’s Beginning Java with NetBeans.

Another primary use of Java today is developing Android apps for tablets and smart phones. So we also offer a great first book on that subject, Murach’s Android Programming (2nd Edition). Like our Servlets and JSP book, this book assumes that you have the skills that are presented in sections 1-4 of Murach’s Beginning Java with NetBeans.

Another Murach book that you should be aware of is Murach’s Java Programming. This book has been one of the best-selling Java books since its first edition in 2001, but it isn’t a beginning book. As a result, it is organized differently, moves faster, goes into greater depth, and presents some additional subjects, particularly on GUI programming and handling data. In general, though, you shouldn’t need this book if you have Murach’s Beginning Java.

What people say about this book

“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

“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

It’s Hard to Learn What You Already Know: I mean, the hardest questions to answer are the ones you don't know enough to ask, and the hardest things to learn are the things you think you already know. [But] every time I open this book I learn something new and useful. And it's not always what I was looking for, which is a good thing.”
- Phil Norcross, Writer, Editor, Webmaster, & Server Administrator; from a review posted on his blog and at Amazon

“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

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 NetBeans

How to open a project

How to open a file in the code editor window

How to compile and run a project

How to use the Output window with a console application

How to work with two or more projects

How to close or delete a project

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 NetBeans to work with a new project

How to create a new project

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

How to use NetBeans to create a new class

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

Sample chapters

If you’re a beginner and want to see whether this book is right for you, please download and read the first chapter. You can also download the book applications and exercises, so you can do the exercise at the end of chapter 1 and work with some sample code.

Chapter 1: An introduction to Java programming

This chapter gets you started by introducing Java programming and showing you how to use NetBeans to create, edit, compile, and run Java projects.

Chapter 1 PDF (1,544Kb) Download Now

Book applications and exercises

This download includes:

  • The Java source code and data for the applications that are presented in the book
  • The starting source code and data for the exercises in the book
  • The solutions to the exercises in the book

All of the code is stored in NetBeans projects that are ready to be used with the NetBeans IDE. Appendix A in the book describes how to install these files on a Windows system, and Appendix B describes the installation process on a Mac.

Exe file for Windows (2Mb) Download Now

Zip file for any system (1.9Mb) Download Now

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 email 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!

eddie evans

Monday, 14 August 2017

I'm inexperienced, thoroughly intimidated, and have bough 6 books on beginning Java, including this book and the other Murach Java book. I've spent a lot of hours and a small fortune.
I can say that Murach's writing and presentation of the material is equal to the others. Its presentation of the material helps with the opposing page view approach to subjects.
The ebook is disappointing, but I'm new to it.
I'll give it another week. The Murach books will save me if anything does..

Jim Kucera

Friday, 14 October 2016

While I believe this one of the best Java books on the market, I was a little disappointed with Chapter 21 & 22 which had all the source code, but I was unable to modify the Swing forms because the palettes were empty. Did I miss something? I couldn't find any solution to explain this condition.

To leave a review, please log in to your account.     Log In Here

Our Ironclad Guarantee

You must be satisfied. Try our print books for 30 days or our eBooks for 14 days. If they aren't the best you've ever used, you can return the books or cancel the eBooks for a prompt refund. No questions asked!

Contact Murach Books

For orders and customer service:

1-800-221-5528

Weekdays, 8 to 4 Pacific Time

College Instructors

If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.