Home > Store

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

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

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

eBook (Watermarked)

  • Your Price: $28.79
  • List Price: $35.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2016
  • Dimensions: 7" x 9-1/8"
  • Edition: 7th
  • eBook (Watermarked)
  • ISBN-10: 0-13-375587-8
  • ISBN-13: 978-0-13-375587-9

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 LanguageDAY 1 Getting Started with JavaDAY 2 The ABCs of ProgrammingDAY 3 Working with ObjectsDAY 4 Lists, Logic, and LoopsDAY 5 Creating Classesand MethodsDAY 6 Packages, Interfaces, and Other Class FeaturesDAY 7 Exceptions and Threads
WEEK 2: The Java Class LibraryDAY 8 Data StructuresDAY 9 Working with SwingDAY 10 Building a Swing InterfaceDAY 11 Arranging Components on a User InterfaceDAY 12 Responding to User InputDAY 13 Creating Java2D GraphicsDAY 14 Developing Swing Applications
WEEK 3: Java ProgrammingDAY 15 Working with Input and OutputDAY 16 Using Inner Classes and ClosuresDAY 17 Communicating Across the InternetDAY 18 Accessing Databases with JDBC 4.2 and DerbyDAY 19 Reading and Writing RSS FeedsDAY 20 XML Web ServicesDAY 21 Writing Android Apps for Java
APPENDIX A Using the NetBeans IDEAPPENDIX B This Book’s WebsiteAPPENDIX C Fixing a Problem with the Android Studio EmulatorAPPENDIX D Using the Java Development KitAPPENDIX E Programming with the Java Development Kit

Sample Content

Table of Contents

Introduction


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
     Inheritance
     Creating a Class Hierarchy
     Inheritance in Action
     Interfaces
     Packages

DAY 2: The ABCs of Programming 
Statements and Expressions
Variables and Data Types
     Creating Variables
     Naming Variables
     Variable Types
     Assigning Values to Variables
     Constants
Comments
Literals
     Number Literals
     Boolean Literals
     Character Literals
     String Literals
Expressions and Operators
     Arithmetic
     More About Assignment
     Incrementing and Decrementing
     Comparisons
     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
Arrays
     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
Constructors
     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 
Modifiers
     Access Control for Methods and Variables
Static Variables and Methods
Final Classes, Methods, and Variables
     Variables
     Methods
     Classes
Abstract Classes and Methods
Packages
     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
Interfaces
     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
Exceptions
     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
Threads
     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
     Iterator
     Bit Sets
     Array Lists
     Looping Through Data Structures
     Stacks
     Map
     Hash Maps
Generics 
Enumerations

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
     Labels
     Text Fields
     Text Areas
     Scrolling Panes
     Check Boxes and Radio Buttons 
     Combo Boxes
Lists
The Java Class Library

DAY 10: Building a Swing Interface
Swing Features
     Standard Dialog Boxes
     Using Dialog Boxes
     Sliders
     Scroll Panes
     Toolbars
     Progress Bars
     Menus
     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
Color  
     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
Closures


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

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


APPENDIXES


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

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020