The Java Language Specification / Edition 3

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Paperback)
  • All (15) from $1.99   
  • New (5) from $4.17   
  • Used (10) from $1.99   

Overview

Written by the inventors of the technology, The Java™ Language Specification, Third Edition , is the definitive technical reference for the Java™ programming language. If you want to know the precise meaning of the language's constructs, this is the source for you.

The book provides complete, accurate, and detailed coverage of the Java programming language. It provides full coverage of all new features added since the previous edition, including generics, annotations, asserts, autoboxing, enums, for-each loops, variable arity methods, and static import clauses.

The authoritative source for high-level information about the language and a basic reference for all serious Java programmers.

Read More Show Less

Editorial Reviews

Booknews
A definitive technical reference for the Java programming language, written by the inventors of the technology. Provides complete coverage of the syntax and semantics of the Java language, covering semantics of all types, statements, and expressions, as well as threads and binary compatibility. This second edition integrates changes made to the Java programming language since the publication of the first edition in 1996. Gosling is fellow and vice president at Sun Microsystems. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780321246783
  • Publisher: Addison-Wesley
  • Publication date: 6/17/2005
  • Series: Java Series
  • Edition description: REV
  • Edition number: 3
  • Pages: 688
  • Product dimensions: 6.92 (w) x 8.97 (h) x 1.49 (d)

Meet the Author

James Gosling is a Fellow and Chief Technology Officer of Sun's Developer Products group, the creator of the Java programming language, and one of the computer industry's most noted programmers. He is the 1996 recipient of Software Development's "Programming Excellence Award." He previously developed NeWS, Sun's network-extensible window system, and was a principal in the Andrew project at Carnegie Mellon University, where he earned a Ph.D. in computer science.

Bill Joy is a cofounder of Sun Microsystems, where he led the company's technical strategy until September 2003, working on both hardware and software architecture. He is well known as the creator of the Berkeley version of the UNIX® operating system, for which he received a lifetime achievement award from the USENIX Association in 1993. He received the ACM Grace Murray Hopper Award in 1986. Joy has had a central role in shaping the Java programming language. He joined KPCB as Partner in January 2005.

Guy L. Steele Jr. is a Sun Fellow at Sun Microsystems Laboratories, where he is responsible for research in language design and implementation strategies, parallel algorithms, and computer arithmetic. He is well known as the cocreator of the Scheme programming language and for his reference books for the C programming language (with Samuel Harbison) and for the Common Lisp programming language. Steele received the ACM Grace Murray Hopper Award in 1988 and was named an ACM Fellow in 1994, a member of the National Academy of Engineering in 2001, and a fellow of the American Academy of Arts and Science in 2002. He also received the 1996 ACM SIGPLAN Programming Languages Achievement Award and the 2005 Dr. Dobb's Journal Excellence in Programming Award.

Gilad Bracha is Computational Theologist at Sun Microsystems, and a researcher in the area of object-oriented programming. Prior to joining Sun, he worked on Strongtalk,™ the Animorphic Smalltalk System. He holds a B.S. in mathematics and computer science from Ben Gurion University in Israel and a Ph.D. in computer science from the University of Utah.

Read More Show Less

Read an Excerpt

About the Java Series

The Java Series books provide definitive reference documentation for Java programmers and end users. They are written by members of the Java team and published under the auspices of JavaSoft, a Sun Microsystems business. The World Wide Web allows Java documentation to be made available over the Internet, either by downloading or as hypertext. Nevertheless, the worldwide interest in Java technology led us to write and publish these books to supplement all of the documentation at our Web site.

To learn the latest about the Java Platform and Environment, or to download the latest Java release, visit our World Wide Web site.

We would like to thank the Corporate and Professional Publishing Group at Addison-Wesley for their partnership in putting together the Series. Our editor Mike Hendrickson and his team have done a superb job of navigating us through the world of publishing. Within Sun, the support of James Gosling, Ruth Hennigar, Jon Kannegaard, and Bill Joy ensured that this series would have the resources it needed to be successful. In addition to the tremendous effort by individual authors, many members of the JavaSoft team have contributed behind the scenes to bring the highest level of quality and engineering to the books in the Series. A personal note of thanks to my children Christopher and James for putting a positive spin on the many trips to my office during the development of the Series.

Lisa Friendly
Series Editor

Preface

Java was originally called Oak, and designed for use in embedded consumer-electronic applications by James Gosling. After several years of experience with the language, and significantcontributions by Ed Frank, Patrick Naughton, Jonathan Payne, and Chris Warth it was retargeted to the Internet, renamed Java, and substantially revised to be the language specified here. The final form of the language was defined by James Gosling, Bill Joy, Guy Steele, Richard Tuck, Frank Yellin, and Arthur van Hoff, with help from Graham Hamilton, Tim Lindholm and many other friends and colleagues.

Java is a general-purpose concurrent class-based object-oriented programming language, specifically designed to have as few implementation dependencies as possible. Java allows application developers to write a program once and then be able to run it everywhere on the Internet.

This book attempts a complete specification of the syntax and semantics of the Java language and the core packages java.lang, java.io, and java.util of its Application Programming Interface. We intend that the behavior of every language construct is specified here, so that all implementations of Java will accept the same programs. Except for timing dependencies or other non-determinisms and given sufficient time and sufficient memory space, a Java program should compute the same result on all machines and in all implementations.

We believe that Java is a mature language, ready for widespread use. Nevertheless, we expect some evolution of the language in the years to come. We intend to manage this evolution in a way that is completely compatible with existing applications. To do this, we intend to make relatively few new versions of the language, and to distinguish each new version with a different filename extension. Java compilers and systems will be able to support the several versions simultannously, with complete compatibility.

Much research and experimentation with Java is already underway. We encourage this work, and will continue to cooperate with external groups to explore improvements to Java. For example, we have already received several interesting proposals for parameterized types. In technically difficult areas, near the state of the art, this kind of research collaboration is essential.

We acknowledge and thank the many people who have contributed to this book through their excellent feedback, assistance and encouragement: Particularly thorough, careful, and thoughtful reviews of drafts were provided by Tom Cargill, Peter Deutsch, Paul Hilfinger, Masayuki Ida, David Moon, Steven Muchnick, Charles L. Perkins, Chris Van Wyk, Steve Vinoski, Philip Wadler, Daniel Weinreb, and Kenneth Zadeck. We are very grateful for their extraordinary volunteer efforts.

We are also grateful for reviews, questions, comments, and suggestions from Stephen Adams, Bowen Alpern, Glenn Ammons, Leonid Arbuzov, Kim Bruce, Edwin Chan, David Chase, Pavel Curtis, Drew Dean, William Dietz, David Dill, Patrick Dussud, Ed Felten, John Giannandrea, John Gilmore, Charles Gust, Warren Harris, Lee Hasiuk, Mike Hendrickson, Mark Hill, Urs Hoelzle, Roger Hoover, Susan Flynn Hummel, Christopher Jang, Mick Jordan, Mukesh Kacker, Peter Kessler, James Larus, Derek Lieber, Bill McKeeman, Steve Naroff, Evi Nemeth, Robert O'Callahan, Dave Papay, Craig Partridge, Scott Pfeffer, Eric Raymond, Jim Roskind, Jim Russell, William Scherlis, Edith Schonberg, Anthony Scian, Matthew Self, Janice Shepherd, Kathy Stark, Barbara Steele, Rob Strom, William Waite, Greg Weeks, and Bob Wilson. (This list was generated semi-automatically from our e-mail records. We apologize if we have omitted anyone.)

The feedback from all these reviewers was invaluable to us in improving the definition of the Java language as well as the form of the presentation in this book. We thank them for their diligence. Any remaining errors in this book-we hope they are few-are our responsibility and not theirs.

We thank Francesca Freedman and Doug Kramer for assistance with matters of typography and layout. We thank Dan Mills of Adobe Systems Incorporated for assistance in exploring possible choices of typefaces.

Many of our colleagues at Sun Microsystems have helped us in one way or another. Lisa Friendly, our series editor, managed our relationship with Addison-Wesley. Susan Stambaugh managed the distribution of many hundreds of copies of drafts to reviewers. We received valuable assistance and technical advice from Ben Adida, Ole Agesen, Ken Arnold, Rick Cattell, Asmus Freytag, Norm Hardy, Steve Heller, David Hough, Doug Kramer, Nancy Lee, Marianne Mueller, Akira Tanaka, Greg Tarsy, David Ungar, Jim Waldo, Ann Wollrath, Geoff Wyant, and Derek White. We thank Alan Baratz, David Bowen, Mike Clary, John Doerr, Jon Kannegaard, Eric Schmidt, Bob Sproull, Bert Sutherland, and Scott McNealy for leadership and encouragement.

The on-line Bartleby Library of Columbia University was invaluable to us during the process of researching and verifying many of the quotations that are scattered throughout this book. Here is one example:

They lard their lean books with the fat of others' works.
-Robert Burton (1576-1640)
We are grateful to those who have toiled on Project Bartleby, for saving us a great deal of effort and reawakening our appreciation for the works of Walt Whitman.

We are thankful for the tools and services we had at our disposal in writing this book: telephones, overnight delivery, desktop workstations, laser printers, photocopiers, text formatting and page layout software, fonts, electronic mail, the World Wide Web, and, of course, the Internet. We live in three different states, scattered across a continent, but collaboration with each other and with our reviewers has seemed almost effortless. Kudos to the thousands of people who have worked over the years to make these excellent tools and services work quickly and reliably.

Mike Hendrickson, Katie Duffy, Simone Payment, and Rosa Aimee Gonzalez of Addison-Wesley were very helpful, encouraging, and patient during the long process of bringing this book to print. We also thank the copy editors.

Rosemary Simpson worked hard, on a very tight schedule, to create the index. We got into the act at the last minute, however; blame us and not her for any jokes you may find hidden therein.

Finally, we are grateful to our families and friends for their love and support during this last, crazy, year.

In their book The C Programming Language, Brian Kernighan and Dennis Ritchie said that they felt that the C language "wears well as one's experience with it grows." If you like C, we think you will like Java. We hope that Java, too, wears well for you.

James Gosling - Cupertino, California
Bill Joy - Aspen, Colorado
Guy Steele - Chelmsford, Massachusetts
July, 1996



Read More Show Less

Table of Contents

Preface.

Preface to the Second Edition.

Preface to the Third Edition.

1. Introduction.

Example Programs.

Notation.

Relationship to Predefined Classes and Interfaces.

References.

2. Grammars.

Context-Free Grammars.

The Lexical Grammar.

The Syntactic Grammar.

Grammar Notation.

3. Lexical Structure.

Unicode.

Lexical Translations.

Unicode Escapes.

Line Terminators.

Input Elements and Tokens.

White Space.

Comments.

Identifiers.

Keywords.

Literals.

Separators.

Operators.

4. Types, Values, and Variables.

The Kinds of Types and Values.

Primitive Types and Values.

Reference Types and Values.

Type Variables.

Parameterized Types.

Type Erasure.

Reifable Types.

Raw Types.

Intersection Types.

Subtyping.

Where Types Are Used.

Variables.

5. Conversions and Promotions.

Kinds of Conversion.

Assignment Conversion.

Method Invocation Conversion.

String Conversion.

Casting Conversion.

Numeric Promotions.

6. Names.

Declarations.

Names and Identifiers.

Scope of a Declaration.

Members and Inheritance.

Determining the Meaning of a Name.

Access Control.

Fully Qualified Names and Canonical Names.

Naming Conventions.

7. Packages.

Package Members.

Host Support for Packages.

Compilation Units.

Package Declarations.

Import Declarations.

Top Level Type Declarations.

Unique Package Names.

8. Classes.

Class Declaration.

Class Members.

Field Declarations.

Method Declarations.

Member Type Declarations.

Instance Initializers.

Static Initializers.

Constructor Declarations.

Enums.

9. Interfaces.

Interface Declarations.

Interface Members.

Field (Constant) Declarations.

Abstract Method Declarations.

Member Type Declarations.

Annotation Types.

Annotations.

10. Arrays.

Array Types.

Array Variables.

Array Creation.

Array Access.

Arrays: A Simple Example.

Array Initializers.

Array Members.

Class Objects for Arrays.

An Array of Characters is Not a String.

Array Store Exception.

11. Exceptions.

The Causes of Exceptions.

Compile-Time Checking of Exceptions.

Handling of an Exception.

An Example of Exceptions.

The Exception Hierarchy.

12. Execution.

Virtual Machine Start-Up.

Loading of Classes and Interfaces.

Linking of Classes and Interfaces.

Initialization of Classes and Interfaces.

Creation of New Class Instances.

Finalization of Class Instances.

Unloading of Classes and Interfaces.

Program Exit.

13. Binary Compatibility.

The Form of a Binary.

What Binary Compatibility Is and Is Not.

Evolution of Packages.

Evolution of Classes.

Evolution of Interfaces.

14. Blocks and Statements.

Normal and Abrupt Completion of Statements.

Blocks.

Local Class Declarations.

Local Variable Declaration Statements.

Statements.

The Empty Statement.

Labeled Statements.

Expression Statements.

The if Statement.

The assert Statement.

The switch Statement.

The while Statement.

The do Statement.

The for Statement.

The break Statement.

The continue Statement.

The return Statement.

The throw Statement.

The synchronized Statement.

The try statement.

Unreachable Statements.

15. Expressions.

Evaluation, Denotation, and Result.

Variables as Values.

Type of an Expression.

FP-strict Expressions.

Expressions and Run-Time Checks.

Normal and Abrupt Completion of Evaluation.

Evaluation Order.

Primary Expressions.

Class Instance Creation Expressions.

Array Creation Expressions.

Field Access Expressions.

Method Invocation Expressions.

Array Access Expressions.

Postfix Expressions.

Unary Operators.

Cast Expressions.

Multiplicative Operators.

Additive Operators.

Shift Operators.

Relational Operators.

Equality Operators.

Bitwise and Logical Operators.

Conditional-And Operator &&.

Conditional-Or Operator .

Conditional Operator ? :.

Assignment Operators.

Expression.

Constant Expression.

16. Definite Assignment.

Definite Assignment and Expressions.

Definite Assignment and Statements.

Definite Assignment and Parameters.

Definite Assignment and Array Initializers.

Definite Assignment and Enum Constants.

Definite Assignment and Anonymous Classes.

Definite Assignment and Member Types.

Definite Assignment and Static Initializers.

Definite Assignment, Constructors, and Instance Initializers.

17. Threads and Locks.

Locks.

Notation in Examples.

Incorrectly Synchronized Programs Exhibit Surprising Behaviors.

Memory Model.

Final Field Semantics.

Word Tearing.

Non-atomic Treatment of double and long.

Wait Sets and Notification.

Sleep and Yield.

18. Syntax.

The Grammar of the Java Programming Language.

Index.

Credits.

Colophon.

Read More Show Less

Preface

This edition of the Java™ Programming Language Specification represents the largest set of changes in the language's history. Generics, annotations, asserts, autoboxing and unboxing, enum types, for-each loops, variable arity methods and static imports have all been added to the language recently. All but asserts are new to the 5.0 release of autumn 2004.

This third edition of The Java™ Language Specification reflects these developments. It integrates all the changes made to the Java programming language since the publication of the second edition in 2000.

The language has grown a great deal in these past four years. Unfortunately, it is unrealistic to shrink a commercially successful programming language--only to grow it more and more. The challenge of managing this growth under the constraints of compatibility and the conflicting demands of a wide variety of uses and users is non-trivial. I can only hope that we have met this challenge successfully with this specification; time will tell.

0321246780P05312005

Read More Show Less

Introduction

The Java™ programming language was originally called Oak, and was designed for use in embedded consumer-electronic applications by James Gosling. After several years of experience with the language, and significant contributions by Ed Frank, Patrick Naughton, Jonathan Payne, and Chris Warth it was retargeted to the Internet, renamed, and substantially revised to be the language specified here. The final form of the language was defined by James Gosling, Bill Joy, Guy Steele, Richard Tuck, Frank Yellin, and Arthur van Hoff, with help from Graham Hamil ton, Tim Lindholm, and many other friends and colleagues.

The Java programming language is a general-purpose concurrent class-based object-oriented programming language, specifically designed to have as few implementation dependencies as possible. It allows application developers to write a program once and then be able to run it everywhere on the Internet. This book attempts a complete specification of the syntax and semantics of the language. We intend that the behavior of every language construct is specified here, so that all implementations will accept the same programs. Except for timing dependencies or other non-determinisms and given sufficient time and sufficient memory space, a program written in the Java programming language should com pute the same result on all machines and in all implementations.

We believe that the Java programming language is a mature language, ready for widespread use. Nevertheless, we expect some evolution of the language in the years to come. We intend to manage this evolution in a way that is completely compatible with existingapplications. To do this, we intend to make relatively few new versions of the language, and to distinguish each new version with a different filename extension. Compilers and systems will be able to support the several ver sions simultannously, with complete compatibility.

Much research and experimentation with the Java platform is already under way. We encourage this work, and will continue to cooperate with external groups to explore improvements to the language and platform. For example, we have already received several interesting proposals for parameterized types. In techni cally difficult areas, near the state of the art, this kind of research collaboration is essential.

We acknowledge and thank the many people who have contributed to this book through their excellent feedback, assistance and encouragement: Particularly thorough, careful, and thoughtful reviews of drafts were provided by Tom Cargill, Peter Deutsch, Paul Hilfinger, Masayuki Ida, David Moon, Steven Muchnick, Charles L. Perkins, Chris Van Wyk, Steve Vinoski, Philip Wadler, Daniel Weinreb, and Kenneth Zadeck. We are very grateful for their extraordinary volunteer efforts.

We are also grateful for reviews, questions, comments, and suggestions from Stephen Adams, Bowen Alpern, Glenn Ammons, Leonid Arbuzov, Kim Bruce, Edwin Chan, David Chase, Pavel Curtis, Drew Dean, William Dietz, David Dill, Patrick Dussud, Ed Felten, John Giannandrea, John Gilmore, Charles Gust, Warren Harris, Lee Hasiuk, Mike Hendrickson, Mark Hill, Urs Hoelzle, Roger Hoover, Susan Flynn Hummel, Christopher Jang, Mick Jordan, Mukesh Kacker, Peter Kessler, James Larus, Derek Lieber, Bill McKeeman, Steve Naroff, Evi Nemeth, Robert O'Callahan, Dave Papay, Craig Partridge, Scott Pfeffer, Eric Raymond, Jim Roskind, Jim Russell, William Scherlis, Edith Schonberg, Anthony Scian, Matthew Self, Janice Shepherd, Kathy Stark, Barbara Steele, Rob Strom, William Waite, Greg Weeks, and Bob Wilson. (This list was generated semi-automatically from our E-mail records. We apologize if we have omitted anyone.)

The feedback from all these reviewers was invaluable to us in improving the definition of the language as well as the form of the presentation in this book. We thank them for their diligence. Any remaining errors in this book---we hope they are few---are our responsibility and not theirs.

We thank Francesca Freedman and Doug Kramer for assistance with matters of typography and layout. We thank Dan Mills of Adobe Systems Incorporated for assistance in exploring possible choices of typefaces.

Many of our colleagues at Sun Microsystems have helped us in one way or another. Lisa Friendly, our series editor, managed our relationship with Addison Wesley. Susan Stambaugh managed the distribution of many hundreds of copies of drafts to reviewers. We received valuable assistance and technical advice from Ben Adida, Ole Agesen, Ken Arnold, Rick Cattell, Asmus Freytag, Norm Hardy, Steve Heller, David Hough, Doug Kramer, Nancy Lee, Marianne Mueller, Akira Tanaka, Greg Tarsy, David Ungar, Jim Waldo, Ann Wollrath, Geoff Wyant, and Derek White. We thank Alan Baratz, David Bowen, Mike Clary, John Doerr, Jon Kannegaard, Eric Schmidt, Bob Sproull, Bert Sutherland, and Scott McNealy for leadership and encouragement.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)