Home > Store

Sams Teach Yourself Java in 24 Hours, 5th Edition

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself Java in 24 Hours, 5th Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2010
  • Edition: 5th
  • Premium Website
  • ISBN-10: 0-672-33076-8
  • ISBN-13: 978-0-672-33076-6

In just 24 lessons of one hour or less, you can learn how to create Java applications with the free NetBeans visual editing tools.

Using a straightforward, step-by-step approach, popular author Rogers Cadenhead helps you master the skills and technology you need to create desktop and web programs, web services, and even a browser game in Java. Each lesson builds on what you’ve already learned, giving you a solid understanding of the basic concepts and terminology.

  • Full-color figures and clear step-by-step instructions visually show you how to program with Java.
  • Quizzes and Exercises at the end of each chapter help you test your knowledge.
  • Notes, Tips, and Cautions provide related information, advice, and warnings.

Learn how to…

  • Set up your Java programming environment
  • Write your first working program in just minutes
  • Control program decisions and behavior
  • Store and work with information
  • Build straightforward user interfaces
  • Create interactive web programs
  • Use threading to build more responsive programs
  • Build a browser-based game from start to finish
  • Read and write files and XML data
  • Master best practices for object-oriented programming
  • Create flexible, interoperable web services with JAX-WS
  • Integrate graphics into your applications


Author's Site

To download source code and activity solutions, and get errata please visit workbench.cadenhead.org/book/java-6-24-hours/.

Sample Content

Online Sample Chapter

Understanding How Java Programs Work

Sample Pages

Download the sample pages (includes Chapter 4 and Index)

Table of Contents


HOUR 1: Becoming a Programmer

Choosing a Language

Telling the Computer What to Do

How Programs Work

How Programs Don’t Work

Choosing a Java Programming Tool

Workshop: Installing a Java Development Tool

HOUR 2: Writing Your First Program

What You Need to Write Programs

Creating the Saluton Program

Beginning the Program

Storing Information in a Variable

Saving the Finished Product

Compiling the Program into a Class File

Fixing Errors

Workshop: Running a Java Program

HOUR 3: Vacationing in Java

First Stop: Sun Microsystems

Going to School with Java

Lunch in JavaWorld

Watching the Skies at NASA

Getting Down to Business

Stopping by Gamelan to Ask for Directions

Workshop: Venturing into Another World

HOUR 4: Understanding How Java Programs Work

Creating an Application

Sending Arguments to Applications

Workshop: Creating an Applet

HOUR 5: Storing and Changing Information in a Program

Statements and Expressions

Assigning Variable Types

Naming Your Variables

Storing Information in Variables

All About Operators

Workshop: Using Expressions

HOUR 6: Using Strings to Communicate

Storing Text in Strings

Displaying Strings in Programs

Using Special Characters in Strings

Pasting Strings Together

Using Other Variables with Strings

Advanced String Handling

Workshop: Presenting Credits

HOUR 7: Using Conditional Tests to Make Decisions

Testing a Condition

if Statements

if-else Statements

switch Statements

The Conditional Operator

Workshop: Watching the Clock

HOUR 8: Repeating an Action with Loops

for Loops

while Loops

do-while Loops

Exiting a Loop

Naming a Loop

Workshop: Testing Your Computer Speed

HOUR 9: Storing Information with Arrays

Creating Arrays

Using Arrays

Multidimensional Arrays

Sorting an Array

Workshop: Array of Prizes, Indeed

HOUR 10: Creating Your First Object

How Object-Oriented Programming Works

Objects in Action

What Objects Are

Understanding Inheritance

Building an Inheritance Hierarchy

Converting Objects and Simple Variables

Workshop: Creating an Object

HOUR 11: Describing What Your Object Is Like

Creating Variables

Creating Class Variables

Creating Behavior with Methods

Putting One Class Inside Another

Using the this Keyword

Workshop: Using Class Methods and Variables

HOUR 12: Making the Most of Existing Objects

The Power of Inheritance

Establishing Inheritance

Working with Existing Objects

Storing Objects of the Same Class in Vectors

Workshop: Creating a Subclass

HOUR 13: Building a Simple User Interface

Swing and the Abstract Windowing Toolkit

Using Components

Workshop: Creating Your Own Component

HOUR 14: Laying Out a User Interface

Using Layout Managers

Workshop: Laying Out an Application

HOUR 15: Responding to User Input

Getting Your Programs to Listen

Setting Up Components to Be Heard

Handling User Events

Workshop: A Little Lotto Madness

HOUR 16: Building a Complex User Interface

Scroll Panes


Change Listeners

Workshop: Using Image Icons and Toolbars

HOUR 17: Creating Interactive Web Programs

Standard Applet Methods

Putting an Applet on a Web Page

Creating an Applet

Sending Parameters from a Web Page

Workshop: Handling Parameters in an Applet

HOUR 18: Handling Errors in a Program


Throwing Exceptions

Workshop: Throwing and Catching


HOUR 19: Creating a Threaded Program


Working with Threads

Starting with init()

Catching Errors as You Set Up URLs

Handling Screen Updates in the paint() Method

Starting the Thread

Handling Mouse Clicks

Workshop: Revolving Links

HOUR 20: Reading and Writing Files


Writing Data to a Stream

Workshop: Reading and Writing Configuration


HOUR 21: Reading and Writing XML Data

Creating an XML File

Reading an XML File

Workshop: Reading RSS Syndication Feeds

HOUR 22: Creating Web Services with JAX-WS

Defining a Service Endpoint Interface

Creating a Service Implementation Bean

Publishing the Web Service

Using Web Service Definition Language


Workshop: Creating a Web Service Client

HOUR 23: Working with Graphics

Using the Font Class

Using the Color Class

Creating Custom Colors

Drawing Lines and Shapes

Workshop: Baking a Pie Graph

HOUR 24: Creating a Browser Game

Designing the Game

Creating a Custom Button in Swing

Creating a Button’s Behavior and Attributes

Clearing Empty Squares with Recursion

Arranging Components as a Grid

Generating Random Numbers

Using the Ternary Operator

Workshop: Publishing an Applet on the Web

APPENDIX A: Using the NetBeans Integrated Development Environment

Installing NetBeans

Creating a New Project

Creating a New Java Class

Running the Application

Fixing Errors

APPENDIX B: Where to Go from Here: Java Resources

Other Books to Consider

Sun’s Official Java Site

Other Java Websites

Internet Relay Chat

Job Opportunities

APPENDIX C: This Book’s Website




Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership