1. Trang chủ
  2. » Giáo án - Bài giảng

Java a beginners guide create, compile, and run java programs today (6th ed ) schildt 2014 (badly formatted)

748 390 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • INTRODUCTION

  • 1€€€Java Fundamentals

  • The Origins of Java

  • How Java Relates to C and C++

  • How Java Relates to C#

  • Java’s Contribution to the Internet

  • Java Applets

  • Security

  • Portability

  • Java’s Magic: The Bytecode

  • The Java Buzzwords

  • Object-Oriented Programming

  • Encapsulation

  • Polymorphism

  • Inheritance

  • Obtaining the Java Development Kit

  • A First Simple Program

  • Entering the Program

  • Compiling the Program

  • The First Sample Program Line by Line

  • Handling Syntax Errors

  • A Second Simple Program

  • Another Data Type

  • Try This 1-1: Converting Gallons to Liters

  • Two Control Statements

  • The if Statement

  • The for Loop

  • Create Blocks of Code

  • Semicolons and Positioning

  • Indentation Practices

  • Try This 1-2: Improving the Gallons-to-Liters Converter

  • The Java Keywords

  • Identifiers in Java

  • The Java Class Libraries

  • Chapter 1 Self Test

  • 2€€€Introducing Data Types and Operators

  • Why Data Types Are Important

  • Java’s Primitive Types

  • Integers

  • Floating-Point Types

  • Characters

  • The Boolean Type

  • Try This 2-1: How Far Away Is the Lightning?

  • Literals

  • Hexadecimal, Octal, and Binary Literals

  • Character Escape Sequences

  • String Literals

  • A Closer Look at Variables

  • Initializing a Variable

  • Dynamic Initialization

  • The Scope and Lifetime of Variables

  • Operators

  • Arithmetic Operators

  • Increment and Decrement

  • Relational and Logical Operators

  • Short-Circuit Logical Operators

  • The Assignment Operator

  • Shorthand Assignments

  • Type Conversion in Assignments

  • Casting Incompatible Types

  • Operator Precedence

  • Try This 2-2: Display a Truth Table for the Logical Operators

  • Expressions

  • Type Conversion in Expressions

  • Spacing and Parentheses

  • Chapter 2 Self Test

  • 3€€€Program Control Statements

  • Input Characters from the Keyboard

  • The if Statement

  • Nested ifs

  • The if-else-if Ladder

  • The switch Statement

  • Nested switch Statements

  • Try This 3-1: Start Building a Java Help System

  • The for Loop

  • Some Variations on the for Loop

  • Missing Pieces

  • The Infinite Loop

  • Loops with No Body

  • Declaring Loop Control Variables Inside the for Loop

  • The Enhanced for Loop

  • The while Loop

  • The do-while Loop

  • Try This 3-2: Improve the Java Help System

  • Use break to Exit a Loop

  • Use break as a Form of goto

  • Use continue

  • Try This 3-3: Finish the Java Help System

  • Nested Loops

  • Chapter 3 Self Test

  • 4€€€Introducing Classes, Objects, and Methods

  • Class Fundamentals

  • The General Form of a Class

  • Defining a Class

  • How Objects Are Created

  • Reference Variables and Assignment

  • Methods

  • Adding a Method to the Vehicle Class

  • Returning from a Method

  • Returning a Value

  • Using Parameters

  • Adding a Parameterized Method to Vehicle

  • Try This 4-1: Creating a Help Class

  • Constructors

  • Parameterized Constructors

  • Adding a Constructor to the Vehicle Class

  • The new Operator Revisited

  • Garbage Collection

  • The finalize( ) Method

  • Try This 4-2: Demonstrate Garbage Collection and Finalization

  • The this Keyword

  • Chapter 4 Self Test

  • 5€€€More Data Types and Operators

  • Arrays

  • One-Dimensional Arrays

  • Try This 5-1: Sorting an Array

  • Multidimensional Arrays

  • Two-Dimensional Arrays

  • Irregular Arrays

  • Arrays of Three or More Dimensions

  • Initializing Multidimensional Arrays

  • Alternative Array Declaration Syntax

  • Assigning Array References

  • Using the length Member

  • Try This 5-2: A Queue Class

  • The For-Each Style for Loop

  • Iterating Over Multidimensional Arrays

  • Applying the Enhanced for

  • Strings

  • Constructing Strings

  • Operating on Strings

  • Arrays of Strings

  • Strings Are Immutable

  • Using a String to Control a switch Statement

  • Using Command-Line Arguments

  • The Bitwise Operators

  • The Bitwise AND, OR, XOR, and NOT Operators

  • The Shift Operators

  • Bitwise Shorthand Assignments

  • Try This 5-3: A ShowBits Class

  • The ? Operator

  • Chapter 5 Self Test

  • 6€€€A Closer Look at Methods and Classes

  • Controlling Access to Class Members

  • Java’s Access Modifiers

  • Try This 6-1: Improving the Queue Class

  • Pass Objects to Methods

  • How Arguments Are Passed

  • Returning Objects

  • Method Overloading

  • Overloading Constructors

  • Try This 6-2: Overloading the Queue Constructor

  • Recursion

  • Understanding static

  • Static Blocks

  • Try This 6-3: The Quicksort

  • Introducing Nested and Inner Classes

  • Varargs: Variable-Length Arguments

  • Varargs Basics

  • Overloading Varargs Methods

  • Varargs and Ambiguity

  • Chapter 6 Self Test

  • 7€€€Inheritance

  • Inheritance Basics

  • Member Access and Inheritance

  • Constructors and Inheritance

  • Using super to Call Superclass Constructors

  • Using super to Access Superclass Members

  • Try This 7-1: Extending the Vehicle Class

  • Creating a Multilevel Hierarchy

  • When Are Constructors Executed?

  • Superclass References and Subclass Objects

  • Method Overriding

  • Overridden Methods Support Polymorphism

  • Why Overridden Methods?

  • Applying Method Overriding to TwoDShape

  • Using Abstract Classes

  • Using final

  • final Prevents Overriding

  • final Prevents Inheritance

  • Using final with Data Members

  • The Object Class

  • Chapter 7 Self Test

  • 8€€€Packages and Interfaces

  • Packages

  • Defining a Package

  • Finding Packages and CLASSPATH

  • A Short Package Example

  • Packages and Member Access

  • A Package Access Example

  • Understanding Protected Members

  • Importing Packages

  • Java’s Class Library Is Contained in Packages

  • Interfaces

  • Implementing Interfaces

  • Using Interface References

  • Try This 8-1: Creating a Queue Interface

  • Variables in Interfaces

  • Interfaces Can Be Extended

  • Default Interface Methods

  • Default Method Fundamentals

  • A More Practical Example of a Default Method

  • Multiple Inheritance Issues

  • Use static Methods in an Interface

  • Final Thoughts on Packages and Interfaces

  • Chapter 8 Self Test

  • 9€€€Exception Handling

  • The Exception Hierarchy

  • Exception Handling Fundamentals

  • Using try and catch

  • A Simple Exception Example

  • The Consequences of an Uncaught Exception

  • Exceptions Enable You to Handle Errors Gracefully

  • Using Multiple catch Statements

  • Catching Subclass Exceptions

  • Try Blocks Can Be Nested

  • Throwing an Exception

  • Rethrowing an Exception

  • A Closer Look at Throwable

  • Using finally

  • Using throws

  • Three Recently Added Exception Features

  • Java’s Built-in Exceptions

  • Creating Exception Subclasses

  • Try This 9-1: Adding Exceptions to the Queue Class

  • Chapter 9 Self Test

  • 10€€€Using I/O

  • Java’s I/O Is Built upon Streams

  • Byte Streams and Character Streams

  • The Byte Stream Classes

  • The Character Stream Classes

  • The Predefined Streams

  • Using the Byte Streams

  • Reading Console Input

  • Writing Console Output

  • Reading and Writing Files Using Byte Streams

  • Inputting from a File

  • Writing to a File

  • Automatically Closing a File

  • Reading and Writing Binary Data

  • Try This 10-1: A File Comparison Utility

  • Random-Access Files

  • Using Java’s Character-Based Streams

  • Console Input Using Character Streams

  • Console Output Using Character Streams

  • File I/O Using Character Streams

  • Using a FileWriter

  • Using a FileReader

  • Using Java’s Type Wrappers to Convert Numeric Strings

  • Try This 10-2: Creating a Disk-Based Help System

  • Chapter 10 Self Test

  • 11€€€Multithreaded Programming

  • Multithreading Fundamentals

  • The Thread Class and Runnable Interface

  • Creating a Thread

  • Some Simple Improvements

  • Try This 11-1: Extending Thread

  • Creating Multiple Threads

  • Determining When a Thread Ends

  • Thread Priorities

  • Synchronization

  • Using Synchronized Methods

  • The synchronized Statement

  • Thread Communication Using notify( ), wait( ), and notifyAll( )

  • An Example That Uses wait( ) and notify( )

  • Suspending, Resuming, and Stopping Threads

  • Try This 11-2: Using the Main Thread

  • Chapter 11 Self Test

  • 12€€€Enumerations, Autoboxing, Static Import, and Annotations

  • Enumerations

  • Enumeration Fundamentals

  • Java Enumerations Are Class Types

  • The values( ) and valueOf( ) Methods

  • Constructors, Methods, Instance Variables, and Enumerations

  • Two Important Restrictions

  • Enumerations Inherit Enum

  • Try This 12-1: A Computer-Controlled Traffic Light

  • Autoboxing

  • Type Wrappers

  • Autoboxing Fundamentals

  • Autoboxing and Methods

  • Autoboxing/Unboxing Occurs in Expressions

  • A Word of Warning

  • Static Import

  • Annotations (Metadata)

  • Chapter 12 Self Test

  • 13€€€Generics

  • Generics Fundamentals

  • A Simple Generics Example

  • Generics Work Only with Reference Types

  • Generic Types Differ Based on Their Type Arguments

  • A Generic Class with Two Type Parameters

  • The General Form of a Generic Class

  • Bounded Types

  • Using Wildcard Arguments

  • Bounded Wildcards

  • Generic Methods

  • Generic Constructors

  • Generic Interfaces

  • Try This 13-1: Create a Generic Queue

  • Raw Types and Legacy Code

  • Type Inference with the Diamond Operator

  • Erasure

  • Ambiguity Errors

  • Some Generic Restrictions

  • Type Parameters Can’t Be Instantiated

  • Restrictions on Static Members

  • Generic Array Restrictions

  • Generic Exception Restriction

  • Continuing Your Study of Generics

  • Chapter 13 Self Test

  • 14€€€Lambda Expressions and Method References

  • Introducing Lambda Expressions

  • Lambda Expression Fundamentals

  • Functional Interfaces

  • Lambda Expressions in Action

  • Block Lambda Expressions

  • Generic Functional Interfaces

  • Try This 14-1: Pass a Lambda Expression as an Argument

  • Lambda Expressions and Variable Capture

  • Throw an Exception from Within a Lambda Expression

  • Method References

  • Method References to static Methods

  • Method References to Instance Methods

  • Constructor References

  • Predefined Functional Interfaces

  • Chapter 14 Self Test

  • 15€€€Applets, Events, and Miscellaneous Topics

  • Applet Basics

  • Applet Organization and Essential Elements

  • The Applet Architecture

  • A Complete Applet Skeleton

  • Applet Initialization and Termination

  • Requesting Repainting

  • The update( ) Method

  • Try This 15-1: A Simple Banner Applet

  • Using the Status Window

  • Passing Parameters to Applets

  • The Applet Class

  • Event Handling

  • The Delegation Event Model

  • Events

  • Event Sources

  • Event Listeners

  • Event Classes

  • Event Listener Interfaces

  • Using the Delegation Event Model

  • Handling Mouse and Mouse Motion Events

  • A Simple Mouse Event Applet

  • More Java Keywords

  • The transient and volatile Modifiers

  • instanceof

  • strictfp

  • assert

  • Native Methods

  • Chapter 15 Self Test

  • 16€€€Introducing Swing

  • The Origins and Design Philosophy of Swing

  • Components and Containers

  • Components

  • Containers

  • The Top-Level Container Panes

  • Layout Managers

  • A First Simple Swing Program

  • The First Swing Example Line by Line

  • Use JButton

  • Work with JTextField

  • Create a JCheckBox

  • Work with JList

  • Try This 16-1: A Swing-Based File Comparison Utility

  • Use Anonymous Inner Classes or Lambda Expressions to Handle Events

  • Create a Swing Applet

  • Chapter 16 Self Test

  • 17€€€Introducing JavaFX

  • JavaFX Basic Concepts

  • The JavaFX Packages

  • The Stage and Scene Classes

  • Nodes and Scene Graphs

  • Layouts

  • The Application Class and the Life-cycle Methods

  • Launching a JavaFX Application

  • A JavaFX Application Skeleton

  • Compiling and Running a JavaFX Program

  • The Application Thread

  • A Simple JavaFX Control: Label

  • Using Buttons and Events

  • Event Basics

  • Introducing the Button Control

  • Demonstrating Event Handling and the Button

  • Three More JavaFX Controls

  • CheckBox

  • Try This 17-1: Use the CheckBox Indeterminate State

  • ListView

  • TextField

  • Introducing Effects and Transforms

  • Effects

  • Transforms

  • Demonstrating Effects and Transforms

  • What Next?

  • Chapter 17 Self Test

  • A€€€Answers to Self Tests

  • Chapter 1: Java Fundamentals

  • Chapter 2: Introducing Data Types and Operators

  • Chapter 3: Program Control Statements

  • Chapter 4: Introducing Classes, Objects, and Methods

  • Chapter 5: More Data Types and Operators

  • Chapter 6: A Closer Look at Methods and Classes

  • Chapter 7: Inheritance

  • Chapter 8: Packages and Interfaces

  • Chapter 9: Exception Handling

  • Chapter 10: Using I/O

  • Chapter 11: Multithreaded Programming

  • Chapter 12: Enumerations, Autoboxing, Static Import, and Annotations

  • Chapter 13: Generics

  • Chapter 14: Lambda Expressions and Method References

  • Chapter 15: Applets, Events, and Miscellaneous Topics

  • Chapter 16: Introducing Swing

  • Chapter 17: Introducing JavaFX

  • B   Using Java’s Documentation Comments

  • The javadoc Tags

  • @author

  • {@code}

  • @deprecated

  • {@docRoot}

  • @exception

  • {@inheritDoc}

  • {@link}

  • {@linkplain}

  • {@literal}

  • @param

  • @return

  • @see

  • @serial

  • @serialData

  • @serialField

  • @since

  • @throws

  • {@value}

  • @version

  • The General Form of a Documentation Comment

  • What javadoc Outputs

  • An Example That Uses Documentation Comments

  • Index

Nội dung

Ngày đăng: 04/09/2018, 14:21

TỪ KHÓA LIÊN QUAN