Professional Documents
Culture Documents
PDF Java Pocket Guide Fourth Edition Robert Liguori Ebook Full Chapter
PDF Java Pocket Guide Fourth Edition Robert Liguori Ebook Full Chapter
Robert Liguori
Visit to download the full and correct content document:
https://textbookfull.com/product/java-pocket-guide-fourth-edition-robert-liguori/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://textbookfull.com/product/java-8-pocket-guide-instant-
help-for-java-programmers-1st-edition-liguori-robert-liguori-
patricia/
https://textbookfull.com/product/pocket-rough-guide-paris-fourth-
edition-rough-guides/
https://textbookfull.com/product/pocket-rough-guide-london-
fourth-edition-samantha-cook/
https://textbookfull.com/product/java-ee-6-pocket-guide-a-quick-
reference-for-simplified-enterprise-java-development-1st-edition-
gupta-arun/
Java Network Programming Fourth Edition Harold Elliotte
https://textbookfull.com/product/java-network-programming-fourth-
edition-harold-elliotte/
https://textbookfull.com/product/java-closures-and-lambda-
fischer-robert/
https://textbookfull.com/product/questions-and-answers-a-guide-
to-fitness-and-wellness-gary-liguori/
https://textbookfull.com/product/questions-and-answers-a-guide-
to-fitness-and-wellness-gary-liguori-2/
https://textbookfull.com/product/beginning-java-with-websphere-
expert-s-voice-in-java-janson-robert-w/
4t
Co
h
ve
Ed
Java
rs
iti
Ja
on
va
8
&
9
Pocket Guide
INSTANT HELP FOR JAVA PROGRAMMERS
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Java Pocket
Guide, the cover image, and related trade dress are trademarks of O’Reilly
Media, Inc.
While the publisher and the authors have used good faith efforts to ensure
that the information and instructions contained in this work are accurate, the
publisher and the authors disclaim all responsibility for errors or omissions,
including without limitation responsibility for damages resulting from the use
of or reliance on this work. Use of the information and instructions contained
in this work is at your own risk. If any code samples or other technology this
work contains or describes is subject to open source licenses or the intellec‐
tual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-491-93869-0
[LSI]
This book is dedicated to our beautiful daughter, Ashleigh.
Table of Contents
Preface xiii
Part I. Language
v
Unicode and ASCII 9
Compact Strings 11
Comments 12
Keywords 13
Identifiers 14
Separators 14
Operators 15
Literals 17
Escape Sequences 20
Unicode Currency Symbols 21
vi | Table of Contents
Variable-Length Argument Lists 54
Abstract Classes and Abstract Methods 55
Static Data Members, Static Methods, Static Constants, and
Static Initializers 56
Interfaces 58
Enumerations 59
Annotation Types 59
Functional Interfaces 62
Table of Contents | ix
Setting Up Scripting Languages and Engines 174
x | Table of Contents
jlink 229
Index 255
Table of Contents | xi
Preface
xiii
ering pursuing one of the Java certifications, you may also wish
to acquire the OCA Java SE 8 Programmer I Study Guide (Exam
1Z0-808) by Edward Finegan and Robert Liguori (McGraw-
Hill Osborne Media, 2015).
Book Structure
This book is broken into three parts: Part I details the Java pro‐
gramming language as derived from the Java Language Specifi‐
cation (JLS) and JEPs. Part II details Java platform components
and related topics. Part III is the appendixes covering support‐
ing technologies.
TIP
This element signifies a tip, suggestion, or general note.
xiv | Preface
WARNING
This element indicates a warning or caution.
O’Reilly Safari
How to Contact Us
Please address comments and questions concerning this book
to the publisher:
Preface | xv
We have a web page for this book, where we list errata, exam‐
ples, and any additional information. You can access this page
at http://bit.ly/java-pocket-guide-4e.
To comment or ask technical questions about this book, send
email to bookquestions@oreilly.com.
For more information about our books, courses, conferences,
and news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
We extend a special thank you to all the folks at O’Reilly.
Appreciation of support also goes out to Greg Grockenberger
and Ryan Cuprak, who wrote for the JShell and Java Module
System chapters, respectively. Ryan also performed the techni‐
cal review of the book, which we appreciate.
We would also like to thank again all of those who participated
with the original Java Pocket Guide, the Java 7 Pocket Guide,
and the Java 8 Pocket Guide.
Additional appreciation to people not related to this book
project: Don Anderson, David Chong, Keith Cianfrani, Jay
Clark, Steve Cullen, Ed DiCampli, Phil Greco, Scott Houck,
Cliff Johnson, Juan Keller, Fran Kelly, Mike Krauss, Mike Lazlo,
Phil Maloney, Lana Manovych, Matt Mariani, Chris Martino,
Roe Morande, Sohrob Mottaghi, Brendan Nugent, Keith Sma‐
niotto, Tom Tessitore, Lacey Thompson, Tyler Travis, Justin
Trulear, and Jack Wombough.
We would finally like to thank all of our family members for
always being there for us.
xvi | Preface
PART I
Language
CHAPTER 1
Naming Conventions
Acronyms
When using acronyms in names, only the first letter of the
acronym should be uppercase and only when uppercase is
appropriate:
// e.g., DNA is represented as Dna
public class GliesianDnaProvider {...}
Annotation Names
Annotation names have been presented several ways in the Java
SE API for predefined annotation types, [adjective|verb]
[noun]:
@Documented
@Retention(RetentionPolicy.RUNTIME)
3
@Target(ElementType.TYPE)
public @interface FunctionalInterface {}
Class Names
Class names should be nouns, as they represent “things” or
“objects.” They should be mixed case (camel case) with only the
first letter of each word capitalized, as in the following:
public class AirDensityCalculator {...}
Constant Names
Constant names should be all uppercase letters, and multiple
words should be separated by underscores:
private static final double KELVIN = 273.16;
private static final double DRY_AIR_GAS_CONSTANT =
287.058;
private static final double HUMID_AIR_GAS_CONSTANT
= 461.4964;
Enumeration Names
Enumeration names should follow the conventions of class
names. The enumeration set of objects (choices) should be all
uppercase letters:
public enum MeasurementSystem {
METRIC, UNITED_STATES_CUSTOMARY, IMPERIAL
}
Interface Names
Interface names should be adjectives. They should end with
“able” or “ible” whenever the interface provides a capability;
otherwise, they should be nouns. Interface names follow the
same capitalization convention as class names:
public interface Relatable {...}
public interface SystemPanel {...}
Method Names
Method names should contain a verb, as they are used to make
an object take action. They should be mixed case, beginning
with a lowercase letter, and the first letter of each subsequent
word should be capitalized. Adjectives and nouns may be
included in method names:
public void clear() {...} // verb
public void toString() // preposition and noun
public double getDryAirDensity() {...} // verb,
Package Names
Package names should be unique and consist of lowercase let‐
ters. Underscores may be used if necessary:
// Gliesian.com (company), JAirDensity (software)
package com.gliesian.jairdensity;
Module Names
Module names should be the reversed internet domain name
with the same guidelines as package names:
module com.gliesian.utils {
}
9
TIP
Java comments, identifiers, and string literals are not limi‐
ted to ASCII characters. All other Java input elements are
formed from ASCII characters.
TIP
ASCII 10 is a newline or linefeed. ASCII 13 is a carriage
return.
Compact Strings
The compact strings feature is an optimization that allows for a
more space-efficient internal representation of strings. It is
enabled by default in Java 9. This feature may be disabled by
using -XX:-CompactStrings, if you are mainly using UTF-16
strings.
Compact Strings | 11
Another random document with
no related content on Scribd:
hän kinasteli usein merellä isänsä kanssa, Eveliinaa hän karttoi ja
lopuksi hän lähti merille eikä antanut vuosikausiin tietoja itsestään.
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.