Part I of thebook is a fast-paced, "no-fluff" introduction to the Java programming language and the core APIs of the Java platform.Part II is a quick reference section that succinctly de
Trang 1Publisher : O'Reilly Pub Date : March 2002 ISBN : 0-596-00773-6 Pages : 992
The 1.4 release of Java 2 Standard edition brings a load of new features - and the potential for frustration Fret not, our new 4th edition has answers The accelerated introduction lets you start writing code right away, and because the book's classic quick reference contains all the classes in the essential Java packages, you can find exactly what you need to make Java's new version work for you.
Trang 2Publisher : O'Reilly Pub Date : March 2002 ISBN : 0-596-00773-6 Pages : 992
Trang 3Section 2.12 Defining and Running Java Programs Section 2.13 Differences Between C and Java Chapter 3 Object-Oriented Programming in Java Section 3.1 Class Definition Syntax
Section 3.2 Fields and Methods
Section 3.3 Creating and Initializing Objects
Section 3.4 Destroying and Finalizing Objects Section 3.5 Subclasses and Inheritance
Section 3.6 Data Hiding and Encapsulation
Section 3.7 Abstract Classes and Methods
Section 3.8 Important Methods of java.lang.Object Section 3.9 Interfaces
Section 3.10 Nested Types
Section 3.11 Modifier Summary
Section 3.12 C++ Features Not Found in Java Chapter 4 Java 5.0 Language Features
Trang 4Section 5.12 XML
Section 5.13 Types, Reflection, and Dynamic Loading Section 5.14 Object Persistence
Section 6.4 Access Control
Section 6.5 Security for Everyone
Section 6.6 Permission Classes
Chapter 7 Programming and Documentation Conventions Section 7.1 Naming and Capitalization Conventions Section 7.2 Portability Conventions and Pure Java Rules Section 7.3 Java Documentation Comments
Trang 5Package java.io
BufferedInputStream BufferedOutputStream BufferedReader
BufferedWriter
ByteArrayInputStream ByteArrayOutputStream CharArrayReader
CharArrayWriter
CharConversionException Closeable
Trang 6InputStream
InputStreamReader
InterruptedIOException InvalidClassException
InvalidObjectException IOException
LineNumberInputStream LineNumberReader
NotActiveException
NotSerializableException ObjectInput
ObjectInputStream
ObjectInputStream.GetField ObjectInputValidation
ObjectOutput
ObjectOutputStream
ObjectOutputStream.PutField ObjectStreamClass
ObjectStreamConstants ObjectStreamException ObjectStreamField
OptionalDataException OutputStream
Trang 7WriteAbortedException
Writer
Chapter 10 java.lang and Subpackages Package java.lang
Trang 8Exception
ExceptionInInitializerError Float
IllegalAccessError
IllegalAccessException
IllegalArgumentException IllegalMonitorStateException IllegalStateException
IllegalThreadStateException IncompatibleClassChangeError IndexOutOfBoundsException InheritableThreadLocal<T> InstantiationError
NoSuchFieldError
NoSuchFieldException
NoSuchMethodError
NoSuchMethodException NullPointerException
Number
NumberFormatException Object
Trang 9System
Thread
Thread.State
Thread.UncaughtExceptionHandler ThreadDeath
VirtualMachineError
Void
Package java.lang.annotation Annotation
AnnotationFormatError
AnnotationTypeMismatchException Documented
ElementType
IncompleteAnnotationException Inherited
Trang 10Retention
RetentionPolicy
Target
Package java.lang.instrument ClassDefinition
ClassFileTransformer
IllegalClassFormatException Instrumentation
UnmodifiableClassException Package java.lang.management ClassLoadingMXBean
CompilationMXBean
GarbageCollectorMXBean ManagementFactory
ManagementPermission
MemoryManagerMXBean MemoryMXBean
Trang 12DatagramSocketImplFactory FileNameMap
NetPermission
NetworkInterface
NoRouteToHostException PasswordAuthentication PortUnreachableException ProtocolException
URISyntaxException
Trang 14FileLock
FileLockInterruptionException GatheringByteChannel
IllegalBlockingModeException
IllegalSelectorException
InterruptibleChannel
NoConnectionPendingException NonReadableChannelException NonWritableChannelException NotYetBoundException
NotYetConnectedException
OverlappingFileLockException Pipe
Package java.nio.channels.spi AbstractInterruptibleChannel
Trang 16IdentityScope
InvalidAlgorithmParameterException InvalidKeyException
KeyStore.LoadStoreParameter KeyStore.PasswordProtection
KeyStore.PrivateKeyEntry
KeyStore.ProtectionParameter
KeyStore.SecretKeyEntry
KeyStore.TrustedCertificateEntry KeyStoreException
Trang 17Principal
PrivateKey
PrivilegedAction<T>
PrivilegedActionException PrivilegedExceptionAction<T> ProtectionDomain
Package java.security.cert Certificate
Certificate.CertificateRep CertificateEncodingException CertificateException
CertificateExpiredException CertificateFactory
CertificateFactorySpi
CertificateNotYetValidException CertificateParsingException
Trang 18CertPath
CertPath.CertPathRep
CertPathBuilder
CertPathBuilderException CertPathBuilderResult
CertPathBuilderSpi
CertPathParameters
CertPathValidator
CertPathValidatorException CertPathValidatorResult
CRLException
CRLSelector
LDAPCertStoreParameters PKIXBuilderParameters
PKIXCertPathBuilderResult PKIXCertPathChecker
PKIXCertPathValidatorResult PKIXParameters
Trang 19X509Extension
Package java.security.interfaces DSAKey
Trang 21Enumeration<E>
EnumMap<K extends Enum<K>,V> EnumSet<E extends Enum<E>> EventListener
EventListenerProxy
EventObject
Trang 22FormatFlagsConversionMismatchException Formattable
Trang 24ExecutionException
Executor
ExecutorCompletionService<V> Executors
ScheduledExecutorService
ScheduledFuture<V>
ScheduledThreadPoolExecutor Semaphore
SynchronousQueue<E>
ThreadFactory
ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy
Trang 26NodeChangeListener
Trang 28EncryptedPrivateKeyInfo
ExemptionMechanism
ExemptionMechanismException ExemptionMechanismSpi
IllegalBlockSizeException KeyAgreement
DHPrivateKey
DHPublicKey
PBEKey
Package javax.crypto.spec DESedeKeySpec
Trang 29ServerSocketFactory
SocketFactory
Package javax.net.ssl
CertPathTrustManagerParameters HandshakeCompletedEvent
HandshakeCompletedListener HostnameVerifier
Trang 32X500Principal
X500PrivateCredential
Chapter 20 javax.xml and Subpackages Package javax.xml
Trang 33TransformerFactory
TransformerFactoryConfigurationError URIResolver
Package javax.xml.transform.dom DOMLocator
Trang 34XPathFactoryConfigurationException XPathFunction
Trang 37Section 23.18 R Section 23.19 S Section 23.20 T Section 23.21 U Section 23.22 V Section 23.23 W Section 23.24 X Section 23.25 Y Section 23.26 Z Colophon
Index
Trang 38This book is dedicated to all
who teach peace and resist violence.
Trang 39Printed in the United States of America
Published by O'Reilly Media, Inc., 1005 Gravenstein HighwayNorth, Sebastopol, CA 95472
O'Reilly books may be purchased for educational, business, orsales promotional use Online editions are also available for
most titles (http://safari.oreilly.com) For more information,contact our corporate/institutional sales department: (800)
998-9938 or corporate@oreilly.com
Nutshell Handbook, the Nutshell Handbook logo, and the
O'Reilly logo are registered trademarks of O'Reilly Media, Inc.Java in a Nutshell, the image of the Javan tiger, and related
While every precaution has been taken in the preparation of thisbook, the publisher and authors assume no responsibility forerrors or omissions, or for damages resulting from the use ofthe information contained herein
Trang 40This book is a desktop Java™ quick reference, designed to sitfaithfully by your keyboard while you program Part I of thebook is a fast-paced, "no-fluff" introduction to the Java
programming language and the core APIs of the Java platform.Part II is a quick reference section that succinctly details mostclasses and interfaces of those core APIs The book covers Java1.0, 1.1, 1.2, 1.3, 1.4, and 5.0
Trang 41The fifth edition of this book covers Java 5.0 As its incrementedversion number attests, this new version of Java has a lot ofnew features The three most significant new language featuresare generic types, enumerated types, and annotations, whichare covered in a new chapter of their own Experienced Javaprogrammers who just want to learn about these new featurescan jump straight to Chapter 4
Trang 42be generic types, providing support for typesafe collections.This is covered in Chapter 4
class This class enables C-style formatted text output with
in Chapter 5 The java.util.Formatter enTRy in the quickreference includes a detailed table of formatting options
The new package java.util.concurrent includes
hierarchy marks these packages as very important, they arenot commonly used Annotation examples are provided in
Chapter 4, and a simple instrumentation and managementexample is found in Chapter 5
New packages have been added to the javax.xml
Trang 43validation with schemas javax.xml.xpath supports theXPath query language And javax.xml.namespace providessimple support for XML namespaces Validation and XPathexamples are in Chapter 5
In a mostly futile attempt to make room for this new material,I've had to make some cuts I've removed coverage of the
packages java.beans, java.beans.beancontext,
reference JavaBeans standards have not caught on in core JavaAPIs and now appear to be relevant only for Swing and relatedgraphical APIs As such, they are no longer relevant in this
book The java.security.acl package has been deprecatedsince Java 1.2 and I've taken this opportunity to remove it And
subset of readers
Along with removing coverage of java.beans from the quickreference section, I've also cut the chapter on JavaBeans fromPart I of this book The material on JavaBeans naming
conventions from that chapter remains useful, however, and hasbeen moved into Chapter 7
Trang 44The first eight chapters of this book document the Java
language, the Java platform, and the Java development toolsthat are supplied with Sun's Java Development Kit (JDK) Thefirst five chapters are essential; the next three cover topics ofinterest to some, but not all, Java programmers
Chapter 1: Introduction
This chapter is an overview of the Java language and theJava platform that explains the important features and
benefits of Java It concludes with an example Java
program and walks the new Java programmer through itline by line
Chapter 2: Java Syntax from the Ground Up
This chapter explains the details of the Java programminglanguage, including some of the Java 5.0 language changes
It is a long and detailed chapter that does not assume
substantial programming experience Experienced Java
programmers can use it as a language reference
Programmers with substantial experience with languagessuch as C and C++ should be able to pick up Java syntaxquickly by reading this chapter; beginning programmerswith only a modest amount of experience should be able tolearn Java programming by studying this chapter carefully
Chapter 3: Object-Oriented Programming in Java
Trang 45documented in Chapter 2 is used to write object-orientedprograms in Java The chapter assumes no prior experiencewith OO programming It can be used as a tutorial by newprogrammers or as a reference by experienced Java
programmers
Chapter 4: Java 5.0 Language Features
This chapter documents the three biggest new features ofJava 5.0: generic types, enumerated types, and
annotations If you read previous editions of this book, youmight want to skip directly to this chapter
Chapter 5: The Java Platform
This chapter is an overview of the essential Java APIs
covered in this book It contains numerous short examplesthat demonstrate how to perform common tasks with theclasses and interfaces that comprise the Java platform
Programmers who are new to Java (and especially thosewho learn best by example) should find this a valuable
chapter
Chapter 6: Java Security
This chapter explains the Java security architecture thatallows untrusted code to run in a secure environment fromwhich it cannot do any malicious damage to the host
system It is important for all Java programmers to have atleast a passing familiarity with Java security mechanisms
Trang 46This chapter documents important and widely adopted Javaprogramming conventions, including JavaBeans namingconventions It also explains how you can make your Javacode self-documenting by including specially formatteddocumentation comments
Chapter 8: Java Development Tools
Sun's JDK includes a number of useful Java developmenttools, most notably the Java interpreter and the Java
compiler This chapter documents those tools
These first eight chapters teach you the Java language and getyou up and running with the Java APIs Part II of the book is asuccinct but detailed API reference formatted for optimum ease
of use Please be sure to readSection II.1 in Part II; it explainshow to get the most out of the quick reference section Also,please note that the quick reference chapters are followed byone final chapter called "Class, Method, and Field Index." Thisspecial index allows you to look up the name of a type and findthe package in which it is defined or to look up the name of amethod or field and find the type in which it it is defined
Trang 47O'Reilly publishes an entire series of books on Java
programming, including several companion books to this one.The companion books are:
Java Examples in a Nutshell
This book contains hundreds of complete, working examplesillustrating many common Java programming tasks using
the core, enterprise, and desktop APIs Java Examples in a
Nutshell is like Chapter 4 of this book, but greatly expanded
in breadth and depth, and with all the code snippets fullyfleshed out into working examples This is a particularlyvaluable book for readers who learn well by experimentingwith existing code
Java Enterprise in a Nutshell
This book is a succinct tutorial for the Java "Enterprise" APIssuch as JDBC, RMI, JNDI, and CORBA It also cover
enterprise tools such as Hibernate, Struts, Ant, JUnit, andXDoclet
J2ME in a Nutshell
This book is a tutorial and quick reference for the graphics,networking, and database APIs of the Java 2 Micro Edition(J2ME) platform
You can find a complete list of Java books from O'Reilly at