Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Java in 21 Days, Sams Teach Yourself (Covering Java 8) / Edition 7

Java in 21 Days, Sams Teach Yourself (Covering Java 8) / Edition 7

by Rogers Cadenhead

See All Formats & Editions

ISBN-10: 067233710X

ISBN-13: 9780672337109

Pub. Date: 01/13/2016

Publisher: Sams

In just 21 days you can acquire the knowledge and skills necessary to develop applications on your computer and apps that run on Android phones and tablets. With this complete tutorial you’ll quickly master the basics and then move on to more advanced features and concepts.

Completely updated for Java 8, this book teaches you about the Java language and


In just 21 days you can acquire the knowledge and skills necessary to develop applications on your computer and apps that run on Android phones and tablets. With this complete tutorial you’ll quickly master the basics and then move on to more advanced features and concepts.

Completely updated for Java 8, this book teaches you about the Java language and how to use it to create applications for any computing environment and Android apps. By the time you have finished the book, you’ll have well-rounded knowledge of Java and the Java class libraries. Using your new skills, you will be able to develop your own programs for tasks such as web services, database connectivity, XML processing, and mobile programming.

No previous programming experience required. By following the 21 carefully organized lessons in this book, anyone can learn the basics of Java programming.

Learn at your own pace. You can work through each chapter sequentially to make sure you thoroughly understand all the concepts and methodologies, or you can focus on specific lessons to learn the techniques that interest you most.

Test your knowledge. Each chapter ends with a Workshop section filled with questions, answers, and exercises for further study. There are even certification practice questions.

  • Completely revised, updated, and expanded to cover the latest features of Java 8
  • Learn to develop Java applications and Android apps using NetBeans and Google’s new Android Studio -- two excellent (and free!) programming platforms
  • Covers new features of Java 8 such as closures, the most eagerly anticipated language feature in years
  • Easy-to-understand, practical examples clearly illustrate the fundamentals of Java programming
  • Discover how Swing can help you quickly develop programs with a graphical user interface
  • Find out about JDBC 4.2 programming with the Derby database and XML parsing with the open source XOM class library
  • Learn how to use streams to write programs that communicate with the Internet, including socket programming, buffers, channels, and URL handling.

Contents at a Glance

WEEK 1: The Java Language
DAY 1 Getting Started with Java
DAY 2 The ABCs of Programming
DAY 3 Working with Objects
DAY 4 Lists, Logic, and Loops
DAY 5 Creating Classesand Methods
DAY 6 Packages, Interfaces, and Other Class Features
DAY 7 Exceptions and Threads

WEEK 2: The Java Class Library
DAY 8 Data Structures
DAY 9 Working with Swing
DAY 10 Building a Swing Interface
DAY 11 Arranging Components on a User Interface
DAY 12 Responding to User Input
DAY 13 Creating Java2D Graphics
DAY 14 Developing Swing Applications

WEEK 3: Java Programming
DAY 15 Working with Input and Output
DAY 16 Using Inner Classes and Closures
DAY 17 Communicating Across the Internet
DAY 18 Accessing Databases with JDBC 4.2 and Derby
DAY 19 Reading and Writing RSS Feeds
DAY 20 XML Web Services
DAY 21 Writing Android Apps for Java

APPENDIX A Using the NetBeans IDE
APPENDIX B This Book’s Website
APPENDIX C Fixing a Problem with the Android Studio Emulator
APPENDIX D Using the Java Development Kit
APPENDIX E Programming with the Java Development Kit

Product Details

Publication date:
Sams Teach Yourself Series
Sales rank:
Product dimensions:
7.00(w) x 9.10(h) x 1.50(d)

Related Subjects

Table of Contents


WEEK I: The Java Language

DAY 1: Getting Started with Java
The Java Language
History of the Language
Introduction to Java
Selecting a Development Tool
Object-Oriented Programming
Objects and Classes
Attributes and Behavior
Attributes of a Class of Objects
Behavior of a Class of Objects
Creating a Class
Running the Program
Organizing Classes and Class Behavior
Creating a Class Hierarchy
Inheritance in Action

DAY 2: The ABCs of Programming
Statements and Expressions
Variables and Data Types
Creating Variables
Naming Variables
Variable Types
Assigning Values to Variables
Number Literals
Boolean Literals
Character Literals
String Literals
Expressions and Operators
More About Assignment
Incrementing and Decrementing
Logical Operators
Operator Precedence
String Arithmetic

DAY 3: Working with Objects
Creating New Objects
How Objects Are Constructed
A Note on Memory Management
Using Class and Instance Variables
Getting Values
Setting Values
Class Variables
Calling Methods
Formatting Strings
Nesting Method Calls
Class Methods
References to Objects
Casting Objects and Primitive Types
Casting Primitive Types
Casting Objects
Converting Primitive Types to Objects and Vice Versa
Comparing Object Values and Classes
Comparing Objects
Determining the Class of an Object

DAY 4: Lists, Logic, and Loops
Declaring Array Variables
Creating Array Objects
Accessing Array Elements
Changing Array Elements
Multidimensional Arrays
Block Statements
If Conditionals
Switch Conditionals
The Ternary Operator
For Loops
While and Do Loops
While Loops
Do-While Loops
Breaking Out of Loops
Labeled Loops

DAY 5: Creating Classes and Methods
Defining Classes
Creating Instance and Class Variables
Defining Instance Variables
Class Variables
Creating Methods
Defining Methods
The this Keyword
Variable Scope and Method Definitions
Passing Arguments to Methods
Class Methods
Creating Java Applications
Helper Classes
Java Applications and Arguments
Passing Arguments to Java Applications
Handling Arguments in Your Java Application
Creating Methods with the Same Name
Basic Constructors
Calling Another Constructor
Overloading Constructors
Overriding Methods
Creating Methods That Override Existing Methods
Calling the Original Method
Overriding Constructors

DAY 6: Packages, Interfaces, and Other Class Features
Access Control for Methods and Variables
Static Variables and Methods
Final Classes, Methods, and Variables
Abstract Classes and Methods
The import Declaration
Class Name Conflicts
Creating Your Own Packages
Picking a Package Name
Creating the Folder Structure
Adding a Class to a Package
Packages and Class Access Control
The Problem of Single Inheritance
Interfaces and Classes
Implementing and Using Interfaces
Implementing Multiple Interfaces
Other Uses of Interfaces
Creating and Extending Interfaces
New Interfaces
Methods Inside Interfaces
Extending Interfaces
Creating an Online Storefront

DAY 7: Exceptions and Threads
Exception Classes
Managing Exceptions
Exception Consistency Checking
Protecting Code and Catching Exceptions
The finally Clause
Declaring Methods That Might Throw Exceptions
The throws Clause
Which Exceptions Should You Throw
Passing on Exceptions throws and Inheritance
Creating and Throwing Exceptions
Throwing Exceptions
Creating Your Own Exceptions
Combining throws, try, and throw
When Not to Use Exceptions
Bad Style Using Exceptions
Writing a Threaded Program
A Threaded Application
Stopping a Thread

WEEK II: The Java Class Library

DAY 8: Data Structures
Moving Beyond Arrays
Java Structures
Bit Sets
Array Lists
Looping Through Data Structures
Hash Maps

DAY 9: Working with Swing
Creating an Application
Creating an Interface
Developing a Framework
Creating a Component
Adding Components to a Container
Working with Components
Image Icons
Text Fields
Text Areas
Scrolling Panes
Check Boxes and Radio Buttons
Combo Boxes
The Java Class Library

DAY 10: Building a Swing Interface
Swing Features
Standard Dialog Boxes
Using Dialog Boxes
Scroll Panes
Progress Bars
Tabbed Panes

DAY 11: Arranging Components on a User Interface
Basic Interface Layout
Laying Out an Interface
Flow Layout
Box Layout
Grid Layout
Border Layout
Mixing Layout Managers
Card Layout
Using Card Layout in an Application
Cell Padding and Insets

DAY 12: Responding to User Input
Event Listeners
Setting Up Components
Event-Handling Methods
Working with Methods
Action Events
Focus Events
Item Events
Key Events
Mouse Events
Mouse Motion Events
Window Events
Using Adapter Classes
Using Inner Classes

DAY 13: Creating Java2D Graphics
The Graphics2D Class
The Graphics Coordinate System
Drawing Text
Improving Fonts and Graphics with Antialiasing
Finding Information About a Font
Using Color Objects
Testing and Setting the Current Colors
Drawing Lines and Polygons
User and Device Coordinate Spaces
Specifying the Rendering Attributes
Creating Objects to Draw
Drawing Objects

DAY 14: Developing Swing Applications
Java Web Start
Using Java Web Start
Creating a JNLP File
Supporting Web Start on a Server
Additional JNLP Elements
Improving Performance with SwingWorker

WEEK III: Java Programming

DAY 15: Working with Input and Output
Introduction to Streams
Using a Stream
Filtering a Stream
Handling Exceptions
Byte Streams
File Streams
Filtering a Stream
Byte Filters
Character Streams
Reading Text Files
Writing Text Files
Files and Paths

DAY 16: Using Inner Classes and Closures
Inner Classes
Anonymous Inner Classes

DAY 17: Communicating Across the Internet
Networking in Java
Opening a Stream Over the Net
Socket Servers
Testing the Server
The java.nio Package

DAY 18: Accessing Databases with JDBC 4.2 and Derby
Java Database Connectivity
Database Drivers
Examining a Database
Reading Records from a Database
Writing Records to a Database
Moving Through Resultsets

DAY 19: Reading and Writing RSS Feeds
Using XML
Designing an XML Dialect
Processing XML with Java
Processing XML with XOM
Creating an XML Document
Modifying an XML Document
Formatting an XML Document
Evaluating XOM

DAY 20: XML Web Services
Introduction to XML-RPC
Communicating with XML-RPC
Sending a Request
Responding to a Request
Choosing an XML-RPC Implementation
Using an XML-RPC Web Service
Creating an XML-RPC Web Service

DAY 21: Writing Android Apps with Java
The History of Android
Writing an Android App
Organizing an Android Project
Creating the Program
Running the App
Designing an Android App
Preparing Resources
Configuring a Manifest File
Designing the Graphical User Interface
Writing Code


APPENDIX A: Using the NetBeans Integrated Development Environment
Installing NetBeans
Creating a New Project
Creating a New Java Class
Running the Application
Fixing Errors
Expanding and Shrinking a Pane
Exploring NetBeans

APPENDIX B: This Book’s Website

APPENDIX C: Fixing a Problem with the Android Studio Emulator
Problems Running an App
Install HAXM in Android Studio
Install HAXM on Your Computer
Checking BIOS Settings

APPENDIX D: Using the Java Development Kit
Choosing a Java Development Tool
Installing the Java Development Kit
Configuring the Java Development Kit
Using a Text Editor
Creating a Sample Program
Compiling and Running the Program in Windows
Setting Up the CLASSPATH Variable

APPENDIX E: Programming with the Java Development Kit
Overview of the JDK
The java Virtual Machine
The javac Compiler
The appletviewer Browser
The javadoc Documentation Tool
The jar Java File Archival Tool
The jdb Debugger
Debugging Applications
Debugging Applets
Advanced Debugging Commands
Using System Properties
The keytool and jarsigner Code Signing Tools

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews