Specifications

Sun Services
Java™ Programming Language
vi
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Identifiers, Keywords, and Types ........................................................................... 3-1
Objectives ................................................................................................................................................. 3-2
Relevance .................................................................................................................................................. 3-4
Comments ................................................................................................................................................ 3-5
Semicolons, Blocks, and White Space .................................................................................................. 3-6
Identifiers ................................................................................................................................................. 3-9
Java Programming Language Keywords .......................................................................................... 3-10
Primitive Types ..................................................................................................................................... 3-11
Logical – boolean ................................................................................................................................. 3-12
Textual – char ....................................................................................................................................... 3-13
Textual – String ................................................................................................................................... 3-14
Integral – byte, short, int, and long ............................................................................................... 3-15
Floating Point – float and double .................................................................................................... 3-17
Variables, Declarations, and Assignments ........................................................................................ 3-19
Java Reference Types ............................................................................................................................ 3-20
Constructing and Initializing Objects ................................................................................................ 3-21
Memory Allocation and Layout .......................................................................................................... 3-22
Explicit Attribute Initialization ........................................................................................................... 3-23
Executing the Constructor ................................................................................................................... 3-24
Assigning a Variable ............................................................................................................................. 3-25
Assigning References ............................................................................................................................ 3-26
Pass-by-Value ........................................................................................................................................ 3-27
The this Reference ............................................................................................................................... 3-32
Java Programming Language Coding Conventions ........................................................................ 3-36
Expressions and Flow Control ............................................................................... 4-1
Objectives ................................................................................................................................................. 4-2
Relevance .................................................................................................................................................. 4-4
Variables and Scope ................................................................................................................................ 4-5
Variable Scope Example ......................................................................................................................... 4-6