Professional Documents
Culture Documents
Dr. Danny Coward has worked on all editions of the Java platform.
He led the definition of Java Servlets into the first version of the Java
EE platform and beyond, web services into the Java ME platform,
and the strategy and planning for Java SE 7. He helped found JavaFX
technology and designed the Java WebSocket API in Java EE. From
coding in Java, to designing APIs with industry experts, to serving
for several years as an executive to the Java Community Process, he
has a uniquely broad perspective into multiple aspects of Java
technology. In addition, he is the author of two books on Java
programming: Java WebSocket Programming and Java EE 7: The Big
Picture. More recently, he has been applying his knowledge of Java
to scale Java-based services for one of the world’s most successful
software companies. Dr. Coward holds bachelor’s, master’s, and
doctorate degrees in mathematics from the University of Oxford.
ISBN: 978-1-26-506270-5
MHID: 1-26-506270-6
The material in this eBook also appears in the print version of this
title: ISBN: 978-1-26-505843-2, MHID: 1-26-505843-1.
TERMS OF USE
This is a copyrighted work and McGraw Hill (“McGraw Hill”) and its
licensors reserve all rights in and to the work. Use of this work is
subject to these terms. Except as permitted under the Copyright Act
of 1976 and the right to store and retrieve one copy of the work,
you may not decompile, disassemble, reverse engineer, reproduce,
modify, create derivative works based upon, transmit, distribute,
disseminate, sell, publish or sublicense the work or any part of it
without McGraw Hill’s prior consent. You may use the work for your
own noncommercial and personal use; any other use of the work is
strictly prohibited. Your right to use the work may be terminated if
you fail to comply with these terms.
McGraw Hill and its licensors do not warrant or guarantee that the
functions contained in the work will meet your requirements or that
its operation will be uninterrupted or error free. Neither McGraw Hill
nor its licensors shall be liable to you or anyone else for any
inaccuracy, error or omission, regardless of cause, in the work or for
any damages resulting therefrom. McGraw Hill has no responsibility
for the content of any information accessed through the work. Under
no circumstances shall McGraw Hill and/or its licensors be liable for
any indirect, incidental, special, punitive, consequential or similar
damages that result from the use of or inability to use the work,
even if any of them has been advised of the possibility of such
damages. This limitation of liability shall apply to any claim or cause
whatsoever whether such claim or cause arises in contract, tort or
otherwise.
Contents at a Glance
2 An Overview of Java
4 Operators
5 Control Statements
6 Introducing Classes
8 Inheritance
10 Exception Handling
11 Multithreaded Programming
14 Generics
15 Lambda Expressions
16 Modules
18 String Handling
19 Exploring java.lang
23 Exploring NIO
24 Networking
25 Event Handling
26 Introducing the AWT: Working with Windows, Graphics, and
Text
28 Images
32 Introducing Swing
33 Exploring Swing
35 Java Beans
36 Introducing Servlets
PART V Appendixes
A Using Java’s Documentation Comments
B Introducing JShell
Index
Contents
Foreword
Preface
Java’s Lineage
The C# Connection
Longevity
Java Applets
Security
Portability
Simple
Object-Oriented
Robust
Multithreaded
Architecture-Neutral
Distributed
Dynamic
The Evolution of Java
A Culture of Innovation
Object-Oriented Programming
Two Paradigms
Abstraction
The if Statement
Lexical Issues
Whitespace
Identifiers
Literals
Comments
Separators
Integers
byte
short
int
long
Floating-Point Types
float
double
Characters
Booleans
Integer Literals
Floating-Point Literals
Boolean Literals
Character Literals
String Literals
Variables
Declaring a Variable
Dynamic Initialization
Arrays
One-Dimensional Arrays
Multidimensional Arrays
Chapter 4 Operators
Arithmetic Operators
Relational Operators
Operator Precedence
Using Parentheses
if
Iteration Statements
while
do-while
for
Nested Loops
Jump Statements
Using break
Using continue
return
Class Fundamentals
A Simple Class
Declaring Objects
Introducing Methods
Returning a Value
Constructors
Parameterized Constructors
Garbage Collection
A Stack Class
Overloading Methods
Overloading Constructors
Returning Objects
Recursion
Understanding static
Introducing final
Arrays Revisited
Chapter 8 Inheritance
Inheritance Basics
Using super
Method Overriding
Packages
Defining a Package
An Access Example
Importing Packages
Interfaces
Defining an Interface
Implementing Interfaces
Nested Interfaces
Applying Interfaces
Variables in Interfaces
Exception-Handling Fundamentals
Exception Types
Uncaught Exceptions
throw
throws
finally
Chained Exceptions
Using Exceptions
Thread Priorities
Synchronization
Messaging
Creating a Thread
Implementing Runnable
Extending Thread
Choosing an Approach
Thread Priorities
Synchronization
Interthread Communication
Deadlock
Virtual Threads
Using Multithreading
Chapter 12 Enumerations, Autoboxing, and Annotations
Enumerations
Enumeration Fundamentals
Type Wrappers
Character
Boolean
Autoboxing
A Word of Warning
Annotations
Annotation Basics
Marker Annotations
Single-Member Annotations
Type Annotations
Repeating Annotations
Some Restrictions
Streams
Reading Characters
Reading Strings
Introducing instanceof
strictfp
Native Methods
Using assert
Static Import
Chapter 14 Generics
Bounded Types
Generic Constructors
Generic Interfaces
A Generic Subclass
Casting
Erasure
Bridge Methods
Ambiguity Errors
Functional Interfaces
Method References
Constructor References
Chapter 16 Modules
Module Basics
Use Services
Module Graphs
Open Modules
requires static
JMOD Files
Records
Record Basics
Enhancements to switch
Text Blocks
Sealed Classes
Sealed Interfaces
Future Directions
String Length
String Literals
String Concatenation
Character Extraction
charAt( )
getChars( )
getBytes( )
toCharArray( )
String Comparison
regionMatches( )
startsWith( ) and endsWith( )
equals( ) Versus ==
compareTo( )
Searching Strings
Modifying a String
substring( )
concat( )
replace( )
Joining Strings
StringBuffer
StringBuffer Constructors
length( ) and capacity( )
ensureCapacity( )
setLength( )
getChars( )
append( )
insert( )
reverse( )
replace( )
substring( )
StringBuilder
Character
Boolean
Void
Process
Runtime
Runtime.Version
ProcessBuilder
System
Environment Properties
Object
Class
ClassLoader
Math
Trigonometric Functions
Exponential Functions
Rounding Functions
StrictMath
Compiler
Thread
ThreadGroup
Package
Module
ModuleLayer
RuntimePermission
Throwable
SecurityManager
StackTraceElement
Enum
Record
ClassValue
Another random document with
no related content on Scribd:
Syötyään aterian ja tyhjennettyään yhdellä henkäyksellä
huumaavan oluen sai Hanna, lopen uupunut kun oli,
vastustamattoman halun nukkua. Hän vastusti yhäti murtavaa
suruaan, paneutui vuoteelleen ja vaipui syvään, monituntiseen
uneen.
Hän lähti tänään ulos ensi kerran senjälkeen kuin oli huoneeseen
muuttanut. Kevein askelin hän kiiruhti kapeita portaita alas, ohi
avoimen ravintolahuoneen oven, josta häntä vastaan tuoksahti
lautasten kolina ja ruuanhaju, sekä jatkoi matkaansa portin kautta
kadulle.
Hanna punastui.
»No, no, älkää olko levoton, neiti hyvä; voihan sattua, ettette halua
ilmaista nimeänne. Naisilla on useinkin syynsä hankkia hiukan rahaa
tuntemattomana. Minä ummistan tällä kertaa silmäni. Jättäkää
korunne tänne, ja minä uhraan kaksisataa guldeniani ja jätän teidät
rauhaan kauniitten kasvojenne takia.»
»Mutta ellen halua myydä medaljonkiani?»
»Niin kutsun poliisin.» Hanna ymmärsi nyt, että mies tahtoi hyötyä
hänen kustannuksellaan. Mutta summa oli hänestä toistaiseksi kyllin
suuri — ja mieluummin näin kuin joutua vieraitten ihmisten
kyseltäväksi.
»No mitä te tiedätte kertoa, neiti Milli? Ette kai te vain ole paikatta?
Minulle on sanottu, että Itävallan, Pietarin ja Amerikan saksalaiset
teatterit kiistelevät teistä.»
»Voi teitä härnäilijää», vastasi Milli neiti Wienin murteella. »Te
tiedätte kyllin hyvin, etten pitkiä aikoja kestä samassa paikassa. Olen
taas purkanut tirehtöörini kanssa. Saako tavata tohtoria?»
Hän jatkoi:
Tämän hän esitti paremmin, sillä hän sai laulussa esiin omat
surunsa. Resitatiivin yli hän pääsi onnellisesti. Lyhyiden,
katkonaisten lauseiden välissä oli laulajattarella tilaisuus hengähtää
ja korkean pitkän fissin lauseessa: »Wie schön ist diese Nacht»,
lauloi hän kauniilla, sointuvalla äänellä.
Mutta andante:
Ja vielä kerran:
»Was doch das Herz — Aphroditens be — (korkea fiss)
weeegt…» — mikä viehkeys — »Dass sie der Tugend, der
Tugend» — oi veitikkaa — »nur Fall.»
»No, tämä saa riittää, minun pitää jo lähteä», sanoi hän pannen
hatun päähänsä. »Minulla on niin paljon toimitettavaa. Hyvästi,
lapset!»