Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Sams Teach Yourself Java™ in 21 Days
PREMIUM
Số trang
1424
Kích thước
30.0 MB
Định dạng
PDF
Lượt xem
1253

Sams Teach Yourself Java™ in 21 Days

Nội dung xem thử

Mô tả chi tiết

About This E-Book

EPUB is an open, industry-standard format for e-books. However, support for

EPUB and its many features varies across reading devices and applications. Use

your device or app settings to customize the presentation to your liking. Settings

that you can customize often include font, font size, single or double column,

landscape or portrait mode, and figures that you can click or tap to enlarge. For

additional information about the settings and features on your reading device or

app, visit the device manufacturer’s Web site.

Many titles include programming code or configuration examples. To

optimize the presentation of these elements, view the e-book in single-column,

landscape mode and adjust the font size to the smallest setting. In addition to

presenting code and configurations in the reflowable text format, we have

included images of the code that mimic the presentation found in the print book;

therefore, where the reflowable format may compromise the presentation of the

code listing, you will see a “Click here to view code image” link. Click the link

to view the print-fidelity code image. To return to the previous page viewed,

click the Back button on your device or app.

Sams Teach Yourself Java™ in 21

Days

Rogers Cadenhead

800 East 96th Street, Indianapolis, Indiana 46240

Sams Teach Yourself Java™ in 21 Days

Copyright © 2016 by Pearson Education, Inc.

All rights reserved. No part of this book shall be reproduced, stored in a retrieval

system, or transmitted by any means, electronic, mechanical, photocopying,

recording, or otherwise, without written permission from the publisher. No

patent liability is assumed with respect to the use of the information contained

herein. Although every precaution has been taken in the preparation of this book,

the publisher and author assume no responsibility for errors or omissions. Nor is

any liability assumed for damages resulting from the use of the information

contained herein.

ISBN-13: 978-0-672-33710-9

ISBN-10: 0-672-33710-X

Library of Congress Control Number: 2015916217

Printed in the United States of America

First Printing December 2015

Editor-in-Chief

Mark Taub

Executive Editor

Mark Taber

Managing Editor

Kristy Hart

Project Editor

Elaine Wiley

Copy Editor

Barbara Hacha

Senior Indexer

Cheryl Lenser

Proofreader

Chuck Hutchinson

Technical Editor

Boris Minkin

Editorial Assistant

Vanessa Evans

Cover Designer

Mark Shirar

Senior Compositor

Gloria Schurick

Trademarks

All terms mentioned in this book that are known to be trademarks or service

marks have been appropriately capitalized. Sams Publishing cannot attest to the

accuracy of this information. Use of a term in this book should not be regarded

as affecting the validity of any trademark or service mark.

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as

possible, but no warranty or fitness is implied. The information provided is on an

“as is” basis. The author and the publisher shall have neither liability nor

responsibility to any person or entity with respect to any loss or damages arising

from the information contained in this book.

Special Sales

For information about buying this title in bulk quantities, or for special sales

opportunities (which may include electronic versions; custom cover designs; and

content particular to your business, training goals, marketing focus, or branding

interests), please contact our corporate sales department at

[email protected] or (800) 382-3419.

For government sales inquiries, please contact

[email protected].

For questions about sales outside the U.S., please contact

[email protected].

Contents at a Glance

Introduction

WEEK I: 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 Classes and Methods

DAY 6 Packages, Interfaces, and Other Class Features

DAY 7 Exceptions and Threads

WEEK II: 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 III: 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 with Java

APPENDIXES

A Using the NetBeans Integrated Development Environment

B This Book’s Website

C Fixing a Problem with the Android Studio Emulator

D Using the Java Development Kit

E Programming with the Java Development Kit

Index

Table of Contents

Introduction

How This Book Is Organized

Who Should Read This Book

Conventions Used in This Book

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

Summary

Q&A

Quiz

Questions

Answers

Certification Practice

Exercises

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

Summary

Q&A

Quiz

Questions

Answers

Certification Practice

Exercises

DAY 3: Working with Objects

Creating New Objects

Using new

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

Summary

Q&A

Quiz

Questions

Answers

Certification Practice

Exercises

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

Summary

Q&A

Quiz

Questions

Answers

Certification Practice

Exercises

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

Summary

Q&A

Quiz

Questions

Answers

Certification Practice

Exercises

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

Tải ngay đi em, còn do dự, trời tối mất!