The Java
®
Language
Specification
Java SE 8 Edition
James Gosling
Bill Joy
Guy Steele
Gilad Bracha
Alex Buckley
2015-02-13
Specification: JSR-337 Java
®
SE 8 Release Contents ("Specification")
Version: 8
Status: Maintenance Release
Release: March 2015
Copyright © 1997, 2015, Oracle America, Inc. and/or its affiliates.
500 Oracle Parkway, Redwood City, California 94065, U.S.A.
All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may
be trademarks of their respective owners.
The Specification provided herein is provided to you only under the Limited License Grant
included herein as Appendix A. Please see Appendix A, Limited License Grant.
To Maurizio, with deepest thanks.
v
Table of Contents
Preface to the Java SE 8 Edition xix
1
Introduction 1
1.1 Organization of the Specification 2
1.2 Example Programs 6
1.3 Notation 6
1.4 Relationship to Predefined Classes and Interfaces 7
1.5 Feedback 7
1.6 References 7
2
Grammars 9
2.1 Context-Free Grammars 9
2.2 The Lexical Grammar 9
2.3 The Syntactic Grammar 10
2.4 Grammar Notation 10
3
Lexical Structure 15
3.1 Unicode 15
3.2 Lexical Translations 16
3.3 Unicode Escapes 17
3.4 Line Terminators 19
3.5 Input Elements and Tokens 19
3.6 White Space 20
3.7 Comments 21
3.8 Identifiers 22
3.9 Keywords 24
3.10 Literals 24
3.10.1 Integer Literals 25
3.10.2 Floating-Point Literals 31
3.10.3 Boolean Literals 34
3.10.4 Character Literals 34
3.10.5 String Literals 35
3.10.6 Escape Sequences for Character and String Literals 37
3.10.7 The Null Literal 38
3.11 Separators 39
3.12 Operators 39