Deitel How to Program Java 7th Edition

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Java is used to develop large-scale enterprise applications, to enhance the functionality of webservers, to provide applications for consumer devices and for many other purposes.

...

Keyword class introduces a class declaration and is immediately followed by the class name.

...

Machine language is the "natural language" of a computer.

...

Phase 1 consists of editing a file with an editor. You type a program using the editor, make correctionsand save the program on a secondary storage device, such as your hard drive.

...

Programmers began using English-like abbreviations to represent elementary operations. Theseabbreviations formed the basis of assembly languages.

...

Programmers insert comments to document programs and improve their readability. The Javacompiler ignores comments.

...

The relational operator > cannot be used with reference types. However, it is possible to comparetwo objects of the same class if that class implements the generic interface Comparable (packagejava.lang).

...

The remainder operator, %, yields the remainder after division.

...

The scope of a label in a labeled break or continue statement is the labeled statement's body.

...

The scope of a local-variable declaration is from the point at which the declaration appears to theend of that block.

...

A method that is declared final in a superclass cannot be overridden in a subclass.

...

Normally, the standard input stream is connected to the keyboard, and the standard outputstream is connected to the computer screen.Section 29.3 Formatting Output with printf

...

Scanner method nextLine reads characters until a newline character is encountered, then returnsthe characters as a String.

...

Similar to binary search, this halving results in log n levels for a total efficiency of O(n log n).Section 16.4 Invariants

...

Simple conditions are expressed in terms of the relational operators >, <, >= and <= and the equalityoperators == and !=, and each expression tests only one condition.

...

Java Enterprise Edition (Java EE) is geared toward developing large-scale, distributed networkingapplications and web-based applications.

.

Java has become the language of choice for implementing Internet-based applications and softwarefor devices that communicate over a network.

.

SummarySection 1.1 Introduction

.

A Java interface describes a set of methods that can be called on an object.

...

A ResultSetMetaData object describes a ResultSet's contents. Programs can use metadata programmaticallyto obtain information about the ResultSet column names and types.

...

A non-static method of an object implicitly uses keyword this to refer to the object's instancevariables and other methods. Keyword this can also be used explicitly.

...

A one-to-many relationship between tables indicates that a row in one table can have many relatedrows in a separate table.

...

As of JDK 6, Sun Microsystems now bundles the open-source, pure Java database Java DB (theSun branded version of Apache Derby) with the JDK.

...

Asynchronized methods is equivalent to a synchronized statement that encloses the entire bodyof a method and with this as the object whose monitor lock will be acquired.

...

At any time, a thread is said to be in one of several thread states. 11371110 Chapter 23 Multithreading

...

At least one catch block or a finally block must immediately follow the try block.

...

At the end of a transaction, a decision can be made either to commit the transaction or roll backthe transaction.

...

At the first format specifier's position, printf substitutes the value of the first argument after theformat string. At each subsequent format specifier's position, printf substitutes the value of thenext argument in the argument list.Section 2.5 Another Java Application: Adding Integers

...

At the operating system level, Java's runnable state typically encompasses two separate states.When a thread first transitions to the runnable state from the new state, the thread is in the readystate. A ready thread enters the running state when the operating system assigns the thread to aprocessor—also known as dispatching the thread.

...

At the time a method is called, its arguments are assigned to its parameters. Then the methodbody uses the parameter variables to access the argument values.

...

Athrow statement specifies an object to be thrown. The operand of a throw can be of any classderived from class Throwable.Section 13.8 Stack Unwinding

...

Athrows clause specifies the exceptions the method throws, and appears after the method's parameterlist and before the method body.

...

Atry block encloses the code that might throw an exception and the code that should not executeif that exception occurs.

...

Attempting to invoke subclass-only methods on a superclass reference is not allowed. Althoughthe actual method that is called depends on the object's type at execution time, a variable can beused to invoke only those methods that are members of that variable's type, which the compilerverifies.Section 10.6 final Methods and Classes

...

Because a wildcard (?) is not a type parameter name, you cannot use it as a type name throughouta method's body.

...

Because the designers of Java want it to be maximally portable, they use internationally recognizedstandards for both character formats (Unicode) and floating-point numbers (IEEE 754).Section 4.14 (Optional) GUI and Graphics Case Study: Creating Simple Drawings

...

Before a class can be imported into multiple applications, the class must be placed in a package.There can be only one package declaration in each Java source-code file, and it must precede allother declarations and statements in the file.

...

Each method can specify parameters that represent additional information the method requiresto perform its task correctly. A method call supplies values—called arguments—for the method'sparameters.

...

Each parameter must specify both a type and an identifier.

...

Each type parameter section contains one or more type parameters (also called formal type parameters)separated by commas.

...

Early computers could perform only one job or task at a time.

...

Either omitting the base case or writing the recursion step incorrectly so that it does not convergeon the base case can cause infinite recursion, eventually exhausting memory. This error is analogousto the problem of an infinite loop in an iterative (nonrecursive) solution.Section 15.4 Example Using Recursion: Fibonacci Series

...

Empty parentheses following a method name indicate that the method does not require any parametersto perform its task.

...

EnumSet static method range takes two parameters—the first enum constant in a range and thelast enum constant in a range—and returns an EnumSet that contains all the constants betweenthese two constants, inclusive. 447420 Chapter 8 Classes and Objects: A Deeper LookSection 8.10 Garbage Collection and Method finalize

...

Historically, concurrency has been implemented with operating system primitives available onlyto experienced systems programmers.

...

HyperlinkEvent method getEventType determines the event type. HyperlinkEvent containsnested class EventType, which declares three hyperlink event types: ACTIVATED (hyperlinkclicked), ENTERED (mouse over a hyperlink) and EXITED (mouse moved away from a hyperlink).HyperlinkEvent method getURL obtains the URL represented by the hyperlink.Section 24.4 Establishing a Simple Server Using Stream Sockets

...

If a catch block throws an exception, the finally block still executes. Then the exception ispassed to the next outer try block—normally in the calling method.

...

If a class declares constructors, the compiler will not create a default constructor. To specify thedefault initialization for objects of a class with multiple constructors, the programmer must declarea no-argument constructor.Section 8.7 Notes on Set and Get Methods

...

If there are more recursive or nested method calls than can be stored on the program executionstack, an error known as a stack overflow occurs.Section 15.6 Recursion vs. Iteration

...

If there are multiple matching catch blocks when an exception occurs, only the first is executed.

...

Implementing an interface is like signing a contract with the compiler that states, "I will declareall the methods specified by the interface or I will declare my class abstract."

...

In 1977, Apple Computer popularized personal computing.

...

Java treats floating-point constants like 1000.0 and 0.05 as type double. Similarly, Java treatswhole number constants like 7 and -22 as type int. 257230 Chapter 5 Control Statements: Part 2

...

Java views each file as a sequential stream of bytes. 755728 Chapter 14 Files and Streams

...

Java's coordinate system provides a scheme for identifying every point on the screen. By default,the upper-left corner of a GUI component has the coordinates (0, 0).

...

JdbcRowSet, a connected RowSet, acts as a wrapper for a ResultSet object and allows you to scrolland update the rows in the ResultSet. Unlike a ResultSet object, a JdbcRowSet object is scrollableand updatable by default.

...

Just as a block can be placed anywhere a single statement can be placed, you can also use an emptystatement, represented by placing a semicolon (;) where a statement would normally be.Section 4.7 while Repetition Statement

...

Just as characters are composed of bits, fields are composed of characters or bytes. A field is agroup of characters or bytes that conveys meaning.

...

Keyword final specifies that a variable is not modifiable—in other words, it is constant. Constantscan be initialized when they are declared or by each of a class's constructors. If a final variableis not initialized, a compilation error occurs.Section 8.14 Software Reusability

...

Keyword public is an access modifier.

...

Keyword void indicates that a method will perform a task but will not return any informationwhen it completes its task. 147120 Chapter 3 Introduction to Classes and Objects

...

Keywords are reserved for use by Java and are always spelled with all lowercase letters.

...

Like operations, the UML models constructors in the third compartment of a class diagram. Todistinguish a constructor from a class's operations, the UML places the word "constructor" betweenguillemets (« and ») before the constructor's name.Section 3.8 Floating-Point Numbers and Type double

...

Like other statements, variable declaration statements end with a semicolon (;).

...

Like public abstract classes, interfaces are typically public types, so they are normally declaredin files by themselves with the same name as the interface and the .java file-name extension.

...

Linked lists are collections of data items "linked up in a chain"—insertions and deletions can bemade anywhere in a linked list.

...

Linked lists can be maintained in sorted order simply by inserting each new element at the properpoint in the list.

...

List nodes normally are not stored contiguously in memory. Rather, they are logically contiguous.Section 17.7 Stacks

...

Listing cases consecutively with no statements between them enables the cases to perform thesame set of statements.

...

Logical operators to enable you to form more complex conditions by combining simple conditions.The logical operators are && (conditional AND), || (conditional OR), & (boolean logicalAND), | (boolean logical inclusive OR), ^ (boolean logical exclusive OR) and ! (logical NOT).

...

Machine languages are machine dependent.

...

Maps map keys to values and cannot contain duplicate keys. Maps differ from Sets in that Maps containboth keys and values, whereas Sets contain only values. HashMaps store elements in a hashtable, and TreeMaps store elements in a tree.

...

Method toString of class ArrayList returns a string of the form "[ elements ]" in which elementsis a comma-separated list of the elements' string representations.

...

Method toString takes no arguments and returns a String. The Object class's toString methodis normally overridden by a subclass.

...

Methods allow you to modularize a program by separating its tasks into self-contained units. Thestatements in a method are written only once and hidden from other methods.

...

Methods often require additional information to perform their tasks. Such additional informationis provided to methods via arguments in method calls.

...

Methods that are declared private are implicitly final, because it is impossible to override themin a subclass.

...

Methods that are declared static are implicitly final.

...

Methods that use wildcards as type arguments cannot be used to add elements to a collection referencedby the parameter.Section 18.9 Generics and Inheritance: Notes

...

Polymorphism enables us to write programs that process objects that share the same superclassin a class hierarchy as if they are all objects of the superclass; this can simplify programming.

...

Polymorphism is particularly effective for implementing layered software systems.Section 10.5 Case Study: Payroll System Using Polymorphism

...

Portions of statements that have values are called expressions.

...

Postincrementing or postdecrementing the variable causes the current value of the variable to beused in the expression in which it appears, and then the variable's value is incremented or decrementedby 1.

...

Precision used with conversion character s indicates the number of characters to be printed.

...

Precision used with floating-point conversion characters e and f indicates the number of digitsthat appear after the decimal point. Precision used with floating-point conversion character g indicatesthe number of significant digits to appear.

...

Preincrementing or predecrementing a variable causes the variable to be incremented or decrementedby 1, and then the new value of the variable is used in the expression in which it appears. 202Summary 175

...

PreparedStatement method setString's first argument represents the number of the parameterbeing set and the second argument is that parameter's value.

...

PreparedStatements also can specify parameters, making them more flexible than Statements.Programs can execute the same query repeatedly with different parameter values.

...

Primitive-type instance variables are initialized by default. Variables of types byte, char, short,int, long, float and double are initialized to 0. Variables of type boolean are initialized to false.

...

PriorityQueue, one of the Queue implementations, orders elements by their natural ordering(i.e., the implementation of the compareTo method) or by a Comparator object that is suppliedthrough the constructor.

...

Private attributes are preceded by a minus sign (-) in the UML.

...

Programmers can throw exceptions by using the throw statement.

...

Programmers use blank lines and space characters to make programs easier to read. Together,blank lines, space characters and tab characters are known as white space. Space characters andtabs are known specifically as white-space characters. White space is ignored by the compiler.

...

Programs connect to, and interact with, relational databases via an interface—software that facilitatescommunications between a database management system and a program.

...

Programs that obtain certain types of resources must return them to the system explicitly to avoidso-called resource leaks. Resource-release code typically is placed in a finally block.

...

Programs use selection statements to choose among alternative courses of action. Summary 173

...

Scanner method next reads characters until any white-space character is encountered, then returnsthe characters as a String.

...

Scanner method nextDouble returns a double value.

...

Scanner method nextInt obtains an integer for use in a program.

...

Scope is the portion of the program in which an entity, such as a variable or a method, can bereferred to by its name. Such an entity is said to be "in scope" for that portion of the program.

...

The ObjectOutput interface contains method writeObject, which takes an Object that implementsinterface Serializable as an argument and writes its information to an OutputStream.

...

The Properties no-argument constructor creates an empty Properties table with no defaultproperties. There is also an overloaded constructor that is passed a reference to a default Propertiesobject containing default property values.

...

The UML has its own data types similar to those of Java. Not all the UML data types have thesame names as the corresponding Java types.

...

The UML indicates the return type of an operation by placing a colon and the return type afterthe parentheses following the operation name.

...

The UML models a parameter of an operation by listing the parameter name, followed by a colonand the parameter type between the parentheses following the operation name.

...

The comma (,) flag uses the locale-specific thousands separator (i.e., ',' for U.S. locale) to displayinteger and floating-point numbers.

...

The Lock and Condition interfaces, which were introduced in Java SE 5, give programmers moreprecise control over thread synchronization, but are more complicated to use.

...

The ObjectInput interface contains method readObject, which reads and returns a reference toan Object from an InputStream. After an object has been read, its reference can be cast to theobject's actual type.

...

The worst case in linear search is that every element must be checked to determine whether thesearch item exists. This occurs if the search key is the last element in the array or is not present.

...

The x-axis describes every horizontal coordinate, and the y-axis every vertical coordinate.

...

There are many ways to organize records in a file. The most common is called a sequential file,in which records are stored in order by the record-key field.

...

There are three kinds of modules in Java—methods, classes and packages. Methods are declaredwithin classes. Classes are typically grouped into packages so that they can be imported into programsand reused.

...

Traditional (multiple-line) comments can be spread over several lines and are delimited by /*and */. All text between the delimiters is ignored by the compiler.

...

Transaction processing enables a program that interacts with a database to treat a database operation(or set of operations) as a single operation. Such an operation is also known as an atomicoperation or a transaction.

...

Translator programs called assemblers were developed to convert early assembly-language programsto machine language at computer speeds.

...

TreeSet method headSet gets a view of a TreeSet that is less than a specified element. MethodtailSet gets a view that is greater than or equal to a specified element. Any changes made to theview are made to the TreeSet.Section 19.10 Maps

...

Type parameters cannot be used in a class's static declarations.

...

Type-wrapper classes (e.g., Integer, Double, Boolean) enable programmers to manipulate primitive-type values as objects. Objects of these classes can be used in collections and data structuresthat can store only references to objects—not primitive-type values.Section 17.3 Autoboxing and Auto-Unboxing

...

A file name ending with the .java extension indicates that the file contains Java source code.

...

A file or directory's path specifies its location on disk.

...

A final method's declaration can never change, so all subclasses use the same method implementation,and calls to final methods are resolved at compile time—this is known as static binding. 547520 Chapter 10 Object-Oriented Programming: Polymorphism

...

A floating-point number is a number with a decimal point, such as 7.33, 0.0975 or 1000.12345.Java provides two primitive types for storing floating-point numbers in memory—float anddouble. The primary difference between these types is that double variables can store numberswith larger magnitude and finer detail (known as the number's precision) than float variables.

...

A foreign key is a column in a table that matches the primary-key column in another table.

...

A fractal is a geometric figure that is generated from a pattern repeated recursively an infinitenumber of times.

...

A generic class can be derived from a non-generic class. For example, Object is a direct or indirectsuperclass of every generic class.

...

A generic class can be derived from another generic class.

...

A generic class declaration looks like a non-generic class declaration, except that the class nameis followed by a type parameter section. As with generic methods, the type parameter section ofa generic class can have one or more type parameters separated by commas.

...

A generic method in a subclass can override a generic method in a superclass if both methodshave the same signatures. SummarySection 19.1 Introduction

...

A generic method may be overloaded. A class can provide two or more generic methods that specifythe same method name but different method parameters. A generic method can also be overloadedby non-generic methods that have the same method name and number of parameters.When the compiler encounters a method call, it searches for the method declaration that mostprecisely matches the method name and the argument types specified in the call.

...

A group of related files is often called a database. A collection of programs designed to create andmanage databases is called a database management system (DBMS).Section 14.3 Files and Streams

...

A has-a relationship represents composition. In a has-a relationship, a class object contains referencesto objects of other classes.Section 9.2 Superclasses and Subclasses

...

A linked list is accessed via a reference to the first node of the list. Each subsequent node is accessedvia the link-reference member stored in the previous node.

...

A linked list is appropriate when the number of data elements to be stored is unpredictable.Linked lists are dynamic, so the length of a list can increase or decrease as necessary.

...

A local variable's declaration must appear before the variable is used in that method. A local variablecannot be accessed outside the method in which it is declared.

...

A logic error has its effect at execution time. A fatal logic error causes a program to fail and terminateprematurely. A nonfatal logic error allows a program to continue executing, but causesthe program to produce incorrect results.

...

A loop invariant is an assertion that is true before you begin executing the loop, during each iterationof the loop and after the loop terminates. SummarySection 17.1 Introduction

...

A major difference among searching algorithms is the amount of effort they require in order toreturn a result.

...

A method call specifies the name of the method to call and provides the arguments that the calledmethod requires to perform its task. When the method call completes, the method returns eithera result or simply control to its caller.

...

A method can perform a task and return a result.

...

A method can return at most one value, but the returned value could be a reference to an objectthat contains many values.

...

A method can specify multiple parameters by separating each parameter from the next with acomma.

...

A method declaration that begins with keyword public indicates that the method is "available tothe public"—that is, it can be called by other classes declared outside the class declaration.

...

A method declared static cannot access non-static class members, because a static methodcan be called even when no objects of the class have been instantiated.

...

A method that requires data to perform its task must specify this in its declaration by placing additionalinformation in the method's parameter list.

...

A method's postcondition is a condition that is true after the method successfully returns.

...

A method's precondition is a condition that must be true when the method is invoked.

...

A multidimensional array with the same number of columns in every row can be created with anarray-creation expression of the formarrayType arrayName[][] = new arrayType[ numRows ][ numColumns ];

...

A new exception class must extend an existing exception class to ensure that the class can be usedwith the exception-handling mechanism. 710Terminology 683Section 13.12 Preconditions and Postconditions

...

A new thread begins its life cycle in the new state. It remains in this state until the program startsthe thread, which places the thread in the runnable state. A thread in the runnable state is consideredto be executing its task.

...

A node can contain data of any type, including objects of other classes.

...

A non-generic class can be derived from a generic class.

...

A stack is a data structure in which data can be added or removed only at the top.

...

A stack is a last-in, first-out (LIFO) data structure. The primary methods used to manipulate astack are push and pop. Method push adds a new node to the top of the stack. Method pop removesa node from the top of the stack and returns the data object from the popped node.

...

A stack is analogous to a pile of dishes. When a dish is placed on the pile, it is always placed atthe top (referred to as pushing the dish onto the stack). Similarly, when a dish is removed fromthe pile, it is always removed from the top (referred to as popping the dish off the stack).

...

A static import declaration enables programmers to refer to imported static members withoutthe class name and a dot (.). A single static import declaration imports one static member,and a static import on demand imports all static members of a class.Section 8.13 final Instance Variables

...

A static variable represents classwide information that is shared among all objects of the class.

...

A subclass can explicitly invoke a constructor of its superclass by using the superclass constructorcall syntax—keyword super, followed by a set of parentheses containing the superclass constructorarguments.Section 9.6 Software Engineering with Inheritance

...

A subclass cannot access or inherit the private members of its superclass—allowing this wouldviolate the encapsulation of the superclass. A subclass can, however, inherit the non-privatemembers of its superclass.

...

A subclass is more specific than its superclass and represents a smaller group of objects.

...

A superclass method can be overridden in a subclass to declare an appropriate implementationfor the subclass.

...

A superclass reference can be used to invoke only methods of the superclass (and the superclasscan invoke overridden versions of these in the subclass).

...

A superclass's private members are accessible only within the declaration of that superclass.

...

A superclass's protected members have an intermediate level of protection between public andprivate access. They can be accessed by members of the superclass, by members of its subclassesand by members of other classes in the same package.

...

A superclass's public members are accessible wherever the program has a reference to an objectof that superclass or one of its subclasses.

...

A total is a variable used to accumulate the sum of several values. Variables used to store totalsare normally initialized to zero before being used in a program.

...

A tree is a nonlinear, two-dimensional data structure. Tree nodes contain two or more links.

...

A type parameter is an identifier that specifies a generic type name. The type parameters can beused as the return type, parameter types and local variable types in a generic method declaration,and they act as placeholders for the types of the arguments passed to the generic method, whichare known as actual type arguments. Type parameters can represent only reference types.

...

A value passed to a method to modify an instance variable is a correct value if that value is in theinstance variable's allowed range. A correct value is always a consistent value, but a consistent valueis not correct if a method receives an out-of-range value and sets it to a consistent value tomaintain the object in a consistent state.

...

A variable declaration statement specifies the name and type of a variable. 102Summary 75

...

A variable is a location in the computer's memory where a value can be stored for use later in aprogram. All variables must be declared with a name and a type before they can be used.

...

A variable's name enables the program to access the value of the variable in memory. A variablename can be any valid identifier.

...

A variable-length argument list is treated as an array within the method body. The number ofarguments in the array can be obtained using the array's length field.Section 7.12, Using Command-Line Arguments

...

ADELETE statement removes rows from a table. The simplest form for a DELETE statement isDELETE FROM tableName WHERE criteriawhere tableName is the table from which to delete a row (or rows). The optional WHERE criteriadetermines which rows to delete. If this clause is omitted, all the table's rows are deleted.Section 25.8.1 Connecting to and Querying a Database

...

AList is an ordered Collection that can contain duplicate elements.

...

AProperties object is a persistent Hashtable object. Class Properties extends Hashtable.

...

AServerSocket object establishes the port where a server waits for connections from clients. Thesecond argument to the ServerSocket constructor is the number of connections that can wait ina queue to connect to the server. If the queue of clients is full, client connections are refused. TheServerSocket method accept waits indefinitely (i.e., blocks) for a connection from a client andreturns a Socket object when a connection is established.

...

ASet is a Collection that contains no duplicate elements. HashSet stores its elements in a hashtable. TreeSet stores its elements in a tree.

...

Abstract classes sometimes constitute several levels of the hierarchy.

...

Abstract methods do not provide implementations.

...

AbstractTableModel method fireTableStructureChanged notifies any JTable using a particularTableModel object as its model that the data in the model has changed.Section 25.9 RowSet Interface

...

Action states represent actions to perform. Each action state contains an action expression thatspecifies a particular action to perform.

...

Activity diagrams are composed of special-purpose symbols, such as action-state symbols, diamondsand small circles. These symbols are connected by transition arrows, which represent theflow of the activity.

...

Activity diagrams are part of the UML. An activity diagram models the workflow (also called theactivity) of a portion of a software system.

...

After a serialized object has been written into a file, it can be read from the file and deserialized—that is, the type information and bytes that represent the object and its data can be used to recreatethe object in memory.

...

After an exception is handled, program control does not return to the throw point, because thetry block has expired. This is known as the termination model of exception handling.

...

After executing a catch block, the program's flow of control proceeds to the first statement afterthe last catch block.

...

Algorithm binarySearch locates an Object in a sorted List.Section 19.7 Stack Class of Package java.util

...

Algorithm shuffle randomly orders the elements of a List.

...

Algorithms addAll appends all the elements in an array to a collection, frequency calculates howmany elements in the collection are equal to the specified element, and disjoint determineswhether two collections have elements in common.

...

Algorithms min and max find the smallest and largest items in a collection.

...

Algorithms sort, binarySearch, reverse, shuffle, fill and copy operate on Lists. Algorithmsmin and max operate on Collections. Algorithm reverse reverses the elements of a List, fillsets every List element to a specified Object, and copy copies elements from one List into anotherList. Algorithm sort sorts the elements of a List.

...

All Java exception classes inherit, either directly or indirectly, from class Exception. Because ofthis fact, Java's exception classes form a hierarchy. Programmers can extend this hierarchy to createtheir own exception classes.

...

All enum types are reference types. An enum type is declared with an enum declaration, which is acomma-separated list of enum constants. The declaration may optionally include other componentsof traditional classes, such as constructors, fields and methods.

...

All generic method declarations have a type parameter section delimited by angle brackets (< and>) that precedes the method's return type.

...

All interface members must be public, and interfaces may not specify any implementation details,such as concrete method declarations and instance variables.

...

All methods declared in an interface are implicitly public abstract methods and all fields areimplicitly public, static and final.

...

All methods in a final class are implicitly final.Section 10.7 Case Study: Creating and Using Interfaces

...

All objects in Java have a special method named toString that returns a String representationof the object's contents. When an object is concatenated with a String, the JVM implicitly callsthe object's toString method to obtain the string representation of the object.

...

All objects in Java have a toString method that returns a String representation of the object.Method toString is called implicitly when an object appears in code where a String is needed.Section 8.4 Referring to the Current Object's Members with the this Reference

...

All objects of a class that implement multiple interfaces have the is-a relationship with each implementedinterface type.

...

All the type-wrapper classes for primitive types implement Comparable.

...

All three expressions in a for header are optional. If the loopContinuationCondition is omitted,Java assumes that the loop-continuation condition is always true, thus creating an infinite loop.You might omit the initialization expression if the program initializes the control variable beforethe loop. You might omit the increment expression if the program calculates the increment withstatements in the loop's body or if no increment is needed.

...

Although you cannot instantiate objects of abstract superclasses, you can use abstract superclassesto declare variables that can hold references to objects of any concrete class derived from thoseabstract superclasses. Programs typically use such variables to manipulate subclass objects polymorphically.

...

An absolute path contains all the directories, starting with the root directory, that lead to a specificfile or directory. Every file or directory on a disk drive has the same root directory in its path.

...

An abstract data type (ADT) consists of a data representation and the operations that can be performedon that data.Section 8.16 Time Class Case Study: Creating Packages

...

An algorithm that is O(1) does not necessarily require only one comparison. It just means thatthe number of comparisons does not grow as the size of the array increases.

...

Java distinguishes between two categories of exceptions: checked and unchecked.

...

Java does not allow programmers to choose between pass-by-value and pass-by-reference—all argumentsare passed by value. A method call can pass two types of values to a method—copies ofprimitive values (e.g., values of type int and double) and copies of references to objects. Althoughan object's reference is passed by value, a method can still interact with the referencedobject by calling its public methods using the copy of the object's reference.

...

Java does not allow subclasses to inherit from more than one superclass, but it does allow a classto inherit from a superclass and implement more than one interface. To implement more thanone interface, use a comma-separated list of interface names after keyword implements in theclass declaration.

...

Java guarantees that a provided finally block will execute whether or not an exception is thrownin the corresponding try block or any of its corresponding catch blocks. Java also guarantees thata finally block executes if a try block exits by using a return, break or continue statement.

...

Java has three types of selection statements. The if statement either performs an action if a conditionis true or skips the action if the condition is false. The if...else statement performs anaction if a condition is true and a different action if the condition is false. The switch statementperforms one of many different actions, depending on the value of an expression.

...

Java imposes no structure on a file—notions such as a record do not exist as part of the Java language.The programmer must structure files to meet an application's requirements.

...

Java includes a fully implemented buffer class named ArrayBlockingQueue in package java.util.concurrent, which implements the BlockingQueue interface. The BlockingQueue interfaceextends the Queue interface and declares methods put and take, the blocking equivalents ofQueue methods offer and poll, respectively.

...

Java includes two versions of an assert statement for validating assertions programatically.

...

Java knows how to evaluate only arithmetic expressions in which the operands' types are identical.To ensure that the operands are of the same type, Java performs an operation called promotion(or implicit conversion) on selected operands. In an expression containing values of the typesint and double, the int values are promoted to double values for use in the expression.

...

Java makes concurrency available to you through the language and APIs. You specify that an applicationcontains separate threads of execution, where each thread has its own method-call stackand program counter, allowing it to execute concurrently with other threads while sharing application-wide resources such as memory with these other threads.

...

Java passes the command-line arguments that appear after the class name in the java commandto the application's main method as Strings in the array args. The number of arguments passedin from the command line is obtained by accessing the array's length attribute. SummarySection 8.2 Time Class Case Study

...

Java performs boxing conversions and unboxing conversions automatically (called autoboxingand auto-unboxing).Section 17.4 Self-Referential Classes

...

Java programmers now have thousands of classes in the Java API from which to choose to helpthem implement Java programs. The Java API classes enable Java programmers to bring new applicationsto market faster by using preexisting, tested components.Section 8.15 Data Abstraction and Encapsulation

...

Java programs communicate with databases and manipulate their data using the JDBC API. AJDBC driver enables Java applications to connect to a database in a particular DBMS and allowsyou to retrieve and manipulate database data.Section 25.2 Relational Databases

...

Java provides a mechanism called object serialization that enables entire objects to be written toor read from a stream.

...

Java provides a rich set of predefined classes that programmers can reuse rather than "reinventingthe wheel." These classes are grouped into packages—named collections of classes.

...

Java provides several compound assignment operators for abbreviating assignment expressions.Any statement of the formvariable = variable operator expression;where operator is one of the binary operators +, -, *, / or % can be written in the formvariable operator= expression;

...

Java provides stream sockets and datagram sockets. With stream sockets, a process establishes aconnection to another process. While the connection is in place, data flows between the processesin streams. Stream sockets are said to provide a connection-oriented service. The protocol usedfor transmission is the popular TCP (Transmission Control Protocol).

...

Java provides the the while, do...while and for repetition (looping) statements that enable programsto perform statements repeatedly as long as a loop-continuation condition remains true.

...

Java provides transaction processing via methods of interface Connection.

...

Java provides two unary operators for adding 1 to or subtracting 1 from the value of a numericvariable. These are the unary increment operator, ++, and the unary decrement operator, --.

...

Java requires all variables to have a type. Thus, Java is referred to as a strongly typed language.

...

TableModel method getRowCount returns the number of rows in the model's ResultSet.

...

TableModel method getValueAt returns the Object at a particular row and column of the model'sunderlying ResultSet.

...

The ! (logical NOT, also called logical negation or logical complement) operator "reverses" themeaning of a condition. The logical negation operator is a unary operator that has only a singlecondition as an operand. The logical negation operator is placed before a condition to choose apath of execution if the original condition (without the logical negation operator) is false.

...

The # flag prefixes 0 to octal values and 0x to hexadecimal values.

...

The ( flag encloses a negative number in parentheses.Section 29.11 Printing with Argument Indices

...

The + flag prints a plus sign for positive values and a minus sign for negative values.

...

The += operator adds the value of the expression on the right of the operator to the value of thevariable on the left of the operator and stores the result in the variable on the left of the operator.Section 4.12 Increment and Decrement Operators

...

The - flag left justifies its argument in a field.

...

The .2 specifies in a format specifier (e.g., %,20.2f) indicates a formatted number's precision—in this case, the number is rounded to the nearest hundredth and output with two digits to theright of the decimal point.Section 5.5 do...while Repetition Statement

...

The 0 flag prints leading zeros for a value that does not occupy its entire field.

...

The Unified Modeling Language (UML) is a graphical language that allows people who buildsystems to represent their object-oriented designs in a common notation.

...

The conversion character c prints a character.

...

Coordinate units are measured in pixels. A pixel is a display monitor's smallest unit of resolution.

...

Each message sent to an object is known as a method call and tells a method of the object to performits task.

...

High-level languages allow programmers to write instructions that look almost like everyday Englishand contain commonly used mathematical notations.

...

The is-a relationship applies only between the subclass and its superclasses, not vice versa.

...

Operating systems were developed to make using computers more convenient.

...

The body of every class declaration is delimited by braces, { and }.

...

The insertion sort algorithm runs in O(n2) time.

...

A sleeping thread remains in the timed waiting state for a designated period of time, after whichit returns to the runnable state.

...

A Scanner (package java.util) enables a program to read data for use in a program. The datacan come from many sources, such as a file on disk or the user at the keyboard. Before using aScanner, the program must create it and specify the source of the data.

...

A benefit of fields is that all the methods of the class can use the fields. Another distinction betweena field and a local variable is that a field has a default initial value provided by Java whenthe programmer does not specify the field's initial value, but a local variable does not.

...

A benefit of implementing interface Comparable is that Comparable objects can be used with thesorting and searching methods of class Collections (package java.util).

...

A binary tree is a tree whose nodes all contain two links. The root node is the first node in a tree.

...

A bounded buffer can be used to minimize the amount of waiting time for threads that shareresources and operate at the same average speeds. If the producer temporarily produces valuesfaster than the consumer can consume them, the producer can write additional values into theextra buffer space (if any are available). If the consumer consumes faster than the producer producesnew values, the consumer can read additional values (if there are any) from the buffer.

...

A boxing conversion converts a value of a primitive type to an object of the corresponding typewrapperclass. An unboxing conversion converts an object of a type-wrapper class to a value ofthe corresponding primitive type.

...

A called method must know how to return to its caller, so the return address of the calling methodis pushed onto the program execution stack when the method is called. If a series of methodcalls occurs, the successive return addresses are pushed onto the stack in last-in, first-out order sothat the last method to execute will be the first to return to its caller.

...

A catch block begins with the keyword catch and an exception parameter followed by a blockof code that catches (i.e., receives) and handles the exception. This code executes when the tryblock detects the exception. 708Summary 681

...

A class can be used to create an instance of the class called an object. This is one of the reasonsJava is known as an object-oriented programming language.

...

A class can have references to objects of other classes as members. Such a capability is called compositionand is sometimes referred to as a has-a relationship.Section 8.9 Enumerations

...

A class may contain static methods to perform common tasks that do not require an object ofthe class. Any data a static method might require to perform its tasks can be sent to the methodas arguments in a method call. A static method is called by specifying the name of the class inwhich the method is declared followed by a dot (.) and the method name, as inClassName.methodName( arguments )

...

A class normally consists of one or more methods that manipulate the attributes (data) that belongto a particular object of the class. Attributes are represented as fields in a class declaration.Such variables are called fields and are declared inside a class declaration but outside the bodiesof the class's method declarations.

...

A class that contains any abstract methods must be declared as an abstract class even if that classcontains some concrete (nonabstract) methods. Each concrete subclass of an abstract superclassalso must provide concrete implementations of each of the superclass's abstract methods.

...

A class that is declared final cannot be a superclass (i.e., a class cannot extend a final class).

...

A collection is an object that can hold references to other objects. The collection interfaces declarethe operations that can be performed on each type of collection.

...

A common way to perform synchronization is to use Java's built-in monitors. Every object has amonitor and a monitor lock. The monitor ensures that its object's monitor lock is held by a maximumof only one thread at any time, and thus can be used to enforce mutual exclusion.

...

A condition is an expression that can be either true or false. Java's if statement allows a programto make a decision based on the value of a condition.

...

A connected RowSet connects to the database once and remains connected until the applicationterminates.

...

A constructor can be used to initialize an object of a class when the object is created.

...

A coordinate pair is composed of an x-coordinate (the horizontal coordinate) and a y-coordinate(the vertical coordinate). The x-coordinate is the horizontal location moving from left to right.The y-coordinate is the vertical location moving top to bottom.

...

A database is an integrated collection of data. A database management system (DBMS) providesmechanisms for storing, organizing, retrieving and modifying data for many users.

...

A disconnected RowSet connects to the database, executes a query to retrieve the data from thedatabase and then closes the connection.

...

A file is a group of related records.

...

A parameter is specified with a question mark (?) in the SQL statement. Before executing a PreparedStatement,the program must specify the parameter values by using the PreparedStatementinterface's set methods.

...

A percent character (%) in a pattern indicates that a string matching the pattern can have zero ormore characters at the percent character's location in the pattern.

...

A primary key provides a unique value that cannot be duplicated in other rows of the same table.

...

A primitive-type variable can store exactly one value of its declared type at a time.

...

A procedure for solving a problem in terms of the actions to execute and the order in which theyexecute is called an algorithm.

...

A program can create an array and initialize its elements with an array initializer (i.e., an initializerlist enclosed in braces).

...

A program can declare arrays of any type. Every element of a primitive-type array contains a variableof the array's declared type. Similarly, in an array of a reference type, every element is a referenceto an object of the array's declared type. 375348 Chapter 7 ArraysSection 7.4, Examples Using Arrays

...

A program can test multiple cases by placing if...else statements inside other if...else statementsto create nested if...else statements.

...

A program refers to any one of an array's elements with an array-access expression that includesthe name of the array followed by the index of the particular element in square brackets ([]).

...

A program will not terminate until its last thread completes execution, at which point the JVMwill also terminate.

...

A prompt directs the user to take a specific action.

...

A queue is similar to a checkout line in a supermarket—the first person in line is serviced first,and other customers enter the line only at the end and wait to be serviced.

...

A record is a group of related fields.

...

A recursive approach can often be implemented with few lines of code, but a corresponding iterativeapproach might take a large amount of code. Another reason to choose a recursive solutionis that an iterative solution might not be apparent.Section 15.8 Fractals

...

A recursive approach is normally preferred over an iterative approach when it more naturally mirrorsthe problem and results in a program that is easier to understand and debug.

...

A recursive call may be a call to another method, which in turn makes a call back to the originalmethod. Such a process still results in a recursive call to the original method. This is known asan indirect recursive call or indirect recursion.Section 15.3 Example Using Recursion: Factorials

...

A recursive method calls itself directly or indirectly through another method.

...

A reference to an object is required to invoke an object's instance methods. A primitive-type variabledoes not refer to an object and therefore cannot be used to invoke a method.Section 3.7 Initializing Objects with Constructors

...

A relational database stores data in tables. Tables are composed of rows, and rows are composedof columns in which values are stored.

...

A relative path normally starts from the directory in which the application began executing.

...

A self-referential class contains a reference that refers to another object of the same class type.Self-referential objects can be linked together to form dynamic data structures.Section 17.5 Dynamic Memory Allocation

...

A sentinel value must be chosen that cannot be confused with an acceptable input value.

...

A separator character is used to separate directories and files in the path.Section 14.5 Sequential-Access Text Files

...

A serialized object is an object represented as a sequence of bytes that includes the object's dataas well as information about the object's type and the types of data stored in the object.

...

A server name and port number are specified when creating a Socket object to enable it to connecta client to the server. A failed connection attempt throws an IOException.

...

A set of promotion rules apply to expressions containing values of two or more primitive typesand to primitive-type values passed as arguments to methods. Each value is promoted to the"highest" type in the expression. In cases where information may be lost due to conversion, theJava compiler requires you to use a cast operator to explicitly force the conversion to occur.Section 6.9 Case Study: Random-Number Generation

...

A set of statements contained within a pair of braces is called a block. A block can be placed anywherein a program that a single statement can be placed.

...

A simple condition containing the boolean logical exclusive OR (^) operator is true if and onlyif one of its operands is true and the other is false. If both operands are true or both are false,the entire condition is false. This operator is also guaranteed to evaluate both of its operands. 259232 Chapter 5 Control Statements: Part 2

...

A single-type-import declaration specifies one class to import. A type-import-on-demand declarationimports only the classes that the program uses from a particular package.

...

An application that creates a Callable likely wants to run it concurrently with other Runnablesand Callables. The ExecutorService interface provides method submit, which will execute aCallable passed in as its argument.

...

An argument index is an optional decimal integer followed by a $ sign that indicates the positionof the argument in the argument list.

...

An argument type followed by an ellipsis (...) in a method's parameter list indicates that themethod receives a variable number of arguments of that particular type. The ellipsis can occuronly once in a method's parameter list, and it must be at the end of the parameter list.Section 7.11, Variable-Length Argument Lists

...

An array is a group of variables (called elements or components) containing values that all havethe same type. Arrays are objects, so they are considered reference types. The elements of an arraycan be either primitive types or reference types (including arrays).

...

An enumeration is introduced by the keyword enum and a type name. As with any class, braces({ and }) delimit the body of an enum declaration. Inside the braces is a comma-separated list ofenumeration constants, each representing a unique value. The identifiers in an enum must beunique. Variables of an enum type can be assigned only constants of that enum type.

...

An exception is an indication of a problem that occurs during a program's execution.

...

An exception's stack trace includes the name of the exception in a descriptive message that indicatesthe problem that occurred and the complete method-call stack (i.e., the call chain) at thetime the exception occurred.

...

An exception's type determines whether the exception is checked or unchecked. All exceptiontypes that are direct or indirect subclasses of class RuntimeException are unchecked exceptions.All exception types that inherit from class Exception but not from RuntimeException arechecked. 709682 Chapter 13 Exception Handling

...

An identity column is the SQL standard way to represent an autoincremented column. The SQLIDENTITY keyword to mark a column as an identity column.Section 25.12 Stored Procedures

...

An if statement always begins with keyword if, followed by a condition in parentheses, and expectsone statement in its body.

...

An import declaration helps the compiler locate a class that is used in a program.

...

An import declaration is not required if you always refer to a class with its fully qualified classname.

...

An important feature of method calls is argument promotion—converting an argument's valueto the type that the method expects to receive in its corresponding parameter.

...

An increment or decrement operator that is prefixed to a variable is the prefix increment or prefixdecrement operator, respectively. An increment or decrement operator that is postfixed to a variableis the postfix increment or postfix decrement operator, respectively.

...

An index must be a nonnegative integer. A program can use an expression as an index.

...

An inorder traversal of a binary search tree processes the node values in ascending order.

...

An interface can declare constants. The constants are implicitly public, static and final. SummarySection 13.1 Introduction

...

An interface declaration begins with the keyword interface and contains only constants and abstractmethods.

...

An interface is often used in place of an abstract class when there is no default implementationto inherit—that is, no fields and no default method implementations.

...

An interface is typically used when disparate (i.e., unrelated) classes need to share common methodsand constants. This allows objects of unrelated classes to be processed polymorphically—objectsof classes that implement the same interface can respond to the same method calls.

...

An interface specifies what operations are allowed but does not specify how the operations areperformed.

...

An invariant is an assertion that is true before and after the execution of a portion of your code.

...

An is a relationship represents inheritance. In an is a relationship, an object of a subclass also canbe treated as an object of its superclass.

...

An object has attributes that are carried with the object as it is used in a program. These attributesare specified as part of the object's class. Attributes are specified in classes by fields.Section 3.3 Declaring a Class with a Method and Instantiating an Object of a Class

...

An object that contains consistent data has data values that are always kept in range.

...

An object that implements interface Connection manages the connection between a Java programand a database. Connection objects enable programs to create SQL statements that accessdata.

...

An object that implements the ExecutorService interface can be created using static methodsdeclared in class Executors (of package java.util.concurrent).

...

An uncaught exception is an exception that occurs for which there are no matching catch blocks.

...

An uncaught exception will cause a program to terminate early if that program contains only onethread. If the program contains more than one thread, only the thread where the exception occurredwill terminate. The rest of the program will run but may yield adverse effects.

...

An underscore ( _ ) in the pattern string indicates a single character at that position in the pattern.Section 25.4.3 ORDER BY Clause

...

AnExecutionException is thrown if an exception occurs during the computation.

...

AnINNER JOIN merges rows from two tables by matching values in columns that are common tothe tables. The basic form for the INNER JOIN operator is:SELECT columnName1, columnName2, ...FROM table1INNER JOIN table2ON table1.columnName = table2.columnNameThe ON clause specifies the columns from each table that are compared to determine whichrows are joined. If a SQL statement uses columns with the same name from multiple tables, thecolumn names must be fully qualified by prefixing them with their table names and a dot (.). 12611234 Chapter 25 Accessing Databases with JDBCSection 25.4.5 INSERT Statement

...

AnINSERT statement inserts a new row into a table. The basic form of this statement isINSERT INTO tableName ( columnName1, columnName2, ..., columnNameN )VALUES ( value1, value2, ..., valueN )where tableName is the table in which to insert the row. The tableName is followed by a commaseparatedlist of column names in parentheses. The list of column names is followed by the SQLkeyword VALUES and a comma-separated list of values in parentheses.

...

AnO(n) algorithm is referred to as having a linear run time.

...

AnUPDATE statement modifies data in a table. The basic form of an UPDATE statement isUPDATE tableNameSET columnName1 = value1, columnName2 = value2, ..., columnNameN = valueNWHERE criteriawhere tableName is the table in which to update data. The tableName is followed by keyword SETand a comma-separated list of column name/value pairs in the format columnName = value. Theoptional WHERE clause criteria determines which rows to update.Section 25.4.7 DELETE Statement

...

Any attempt to create an object of an enum type with operator new results in a compilation error.

...

Any block may contain variable declarations. If a local variable or parameter in a method has thesame name as a field, the field is shadowed until the block terminates execution.Section 6.12 Method Overloading

...

Any class that contains public static void main( String args[] ) can be used to execute an application.

...

Any computing problem can be solved by executing a series of actions in a specific order.

...

Any object can contain a reference to an object that implements the Lock interface (of packagejava.util.concurrent.locks). A thread calls the Lock's lock method to acquire the lock. Oncea Lock has been obtained by one thread, the Lock object will not allow another thread to obtainthe Lock until the first thread releases the Lock (by calling the Lock's unlock method).

...

Any problem that can be solved recursively can also be solved iteratively.

...

Anywhere a single action may be placed, several actions may be placed in sequence.

...

Applet method getAppletContext returns a reference to an AppletContext object that representsthe applet's environment (i.e., the browser in which the applet is executing). AppletContextmethod showDocument receives a URL as an argument and passes it to the AppletContext (i.e., thebrowser), which displays the web resource associated with that URL. A second version of showDocumentenables an applet to specify the target frame in which to display a web resource. Special 11951168 Chapter 24 Networkingtarget frames include _blank (display in a new web browser window), _self (display in the sameframe as the applet) and _top (remove the current frames, then display in the current window).Section 24.3 Reading a File on a Web Server

...

Argument indices enable programmers to reorder the output so that the arguments in the argumentlist are not necessarily in the order of their corresponding format specifiers. Argument indicesalso help avoid duplicating arguments.Section 29.13 Formatting Output with Class Formatter

...

Arithmetic expressions in Java must be written in straight-line form.

...

ArrayBlockingQueue stores shared data in an array. The array's size is specified as an argumentto the ArrayBlockingQueue constructor. Once created, an ArrayBlockingQueue is fixed in sizeand will not expand to accommodate extra elements. 1140Summary 1113Section 23.8 Producer/Consumer Relationship with Synchronization

...

Arrays are data structures consisting of related data items of the same type. Arrays are fixed-lengthentities—they remain the same length once they are created, although an array variable may bereassigned the reference of a new array of a different length.Section 7.2, Arrays

...

Arrays method asList returns a List view of an array, which enables a program to manipulatethe array as if it were a List. Any modifications made through the List view change the array,and any modifications to the array change the List view.

...

Arrays that require two indices to identify a particular element are called two-dimensional arrays.An array with m rows and n columns is called an m-by-n array. A two-dimensional array can beinitialized with an array initializer of the formarrayType arrayName[][] = { { row1 initializer }, { row2 initializer }, ... }; 376Terminology 349

...

Arunnable thread can enter the timed waiting state for a specified interval of time. A timed waitingthread transitions back to the runnable state when that time interval expires or when the eventit is waiting for occurs.

...

Arunnable thread can transition to the timed waiting state if it provides an optional wait intervalwhen it is waiting for another thread to perform a task. Such a thread will return to the runnablestate when it is notified by another thread or when the timed interval expires.

...

Arunnable thread enters the terminated state when it successfully completes its task or otherwiseterminates (perhaps due to an error).

...

Arunnable thread transitions to the blocked state when it attempts to perform a task that cannotbe completed immediately and the thread must temporarily wait until that task completes. Atthat point, the blocked thread transitions to the runnable state, so it can resume execution. Ablocked thread cannot use a processor, even if one is available.

...

Before writing a program to solve a problem, you must have a thorough understanding of theproblem and a carefully planned approach to solving it. You must also understand the buildingblocks that are available and to employ proven program-construction techniques.Section 4.2 Algorithms

...

Big O is designed to highlight dominant factors and ignore terms that become unimportant withhigh n values.

...

Big O notation is concerned with the growth rate of algorithm run times, so constants areignored.

...

Binary search is a more efficient searching algorithm than linear search because each comparisoneliminates from consideration half of the elements in the array.

...

Binary search runs in O(log n) time because each step removes half of the remaining elements.

...

Binary trees facilitate high-speed searching and sorting of data, eliminating duplicate data itemsefficiently, representing file-system directories and compiling expressions into machine language.Section 17.2 Type-Wrapper Classes for Primitive Types

...

Bohm and Jacopini demonstrated that all programs could be written in terms of only three controlstructures—the sequence structure, the selection structure and the repetition structure.

...

Both iteration and recursion are based on a control statement: Iteration uses a repetition statement,recursion a selection statement.

...

Both iteration and recursion can occur infinitely: An infinite loop occurs with iteration if theloop-continuation test never becomes false, whereas infinite recursion occurs if the recursion stepdoes not reduce the problem each time in a manner that converges on the base case.

...

Both iteration and recursion involve repetition: Iteration explicitly uses a repetition statement,whereas recursion achieves repetition through repeated method calls.

...

Buffering is an I/O-performance-enhancement technique. With a BufferedOutputStream, eachoutput statement does not necessarily result in an actual physical transfer of data to the outputdevice. Rather, each output operation is directed to a region in memory called a buffer that islarge enough to hold the data of many output operations. Actual transfer to the output device isthen performed in one large physical output operation each time the buffer fills.

...

By convention, method names begin with a lowercase first letter and all subsequent words in thename begin with a capital first letter.

...

By convention, the link reference in the last node of a list is set to null to mark the end of the list.

...

By default, every thread is given priority NORM_PRIORITY (a constant of 5). Each new thread inheritsthe priority of the thread that created it.

...

By synchronizing threads, you can ensure that each thread accessing a shared object excludes allother threads from doing so simultaneously—this is called mutual exclusion.

...

Byte-based streams represent data in binary format.

...

CachedRowSet, a disconnected RowSet, caches the data of a ResultSet in memory. Like Jdbc-RowSet, a CachedRowSet object is scrollable and updatable. A CachedRowSet object is also serializable,so it can be passed between Java applications through a network, such as the Internet. 12631236 Chapter 25 Accessing Databases with JDBCSection 25.10 Java DB/Apache Derby

...

CallableStatement can specify input parameters, like PreparedStatement. In addition, CallableStatementcan specify output parameters in which a stored procedure can place return values.Section 25.13 Transaction Processing

...

Carefully prepared pseudocode can easily be converted to a corresponding Java program.Section 4.4 Control Structures

...

Cast operators are available for any type. The cast operator is formed by placing parenthesesaround the name of a type. The operator is a unary operator.Section 4.11 Compound Assignment Operators

...

Chained exceptions enable an exception object to maintain the complete stack-trace information,including information about previous exceptions that caused the current exception.Section 13.11 Declaring New Exception Types

...

Character-based input and output can be performed with classes Scanner and Formatter.

...

Character-based streams represent data as sequences of characters.

...

Characters in Java are Unicode characters composed of two bytes, each composed of eight bits.

...

Class Arrays provides static methods for manipulating arrays, including sort for sorting an array,binarySearch for searching a sorted array, equals for comparing arrays and fill for placingitems in an array.

...

Class Collections provides static methods for manipulating collections. Many of the methodsare implementations of polymorphic algorithms for searching, sorting and so on.Section 19.5 Lists

...

Class Error and its subclasses represent exceptional situations that could happen in the Javaruntime system. Errors happen infrequently, and typically should not be caught by an application.

...

Class Exception and its subclasses represent exceptional situations that could occur in a Java programand be caught by the application.

...

Class File is used to obtain information about files and directories.

...

Class Formatter (in package java.util) provides the same formatting capabilities as printf.Formatter is a utility class that enables programmers to print formatted output to various destinations,including GUI components, files and other output streams.

...

Class Formatter enables formatted data to be output to the screen or to a file in a manner similarto System.out.printf.

...

Class Formatter's method format outputs formatted data to the destination specified by the Formatterconstructor.

...

Class Graphics (from package java.awt) provides various methods for drawing text and shapesonto the screen.

...

Class JPanel (from package javax.swing) provides an area on which a program can draw.

...

Class Math provides static methods for performing common mathematical calculations. ClassMath declares two fields that represent commonly used mathematical constants: Math.PI andMath.E. The constant Math.PI (3.14159265358979323846) is the ratio of a circle's circumferenceto its diameter. The constant Math.E (2.7182818284590452354) is the base value for naturallogarithms (calculated with static Math method log).

...

Class Number is the superclass of both Integer and Double.

...

Class Random provides another version of method nextInt that receives an int argument and returnsa value from 0 up to, but not including, the argument's value.

...

Class ReentrantLock (of package java.util.concurrent.locks) is a basic implementation of theLock interface.

...

Class Stack extends Vector. Stack method push adds its argument to the top of the stack. Methodpop removes the top element of the stack. Method peek returns a reference to the top elementwithout removing it. Stack method empty determines whether the stack is empty.Section 19.8 Class PriorityQueue and Interface Queue

...

Class String is in package java.lang, which is imported implicitly into all source-code files.

...

Class Throwable also provides a getStackTrace method that obtains stack-trace informationprinted by printStackTrace.

...

Class Throwable has two subclasses: Exception and Error.

...

Class Throwable is the superclass of class Exception, and is therefore also the superclass of all exceptions.Only Throwable objects can be used with the exception-handling mechanism.

...

Class Throwable offers a printStackTrace method that prints the method-call stack. Often, thisis helpful in testing and debugging.

...

Class Throwable's getMessage method returns the descriptive string stored in an exception.

...

Class Vector manages dynamically resizable arrays. At any time, a Vector contains a number ofelements that is less than or equal to its capacity. If a Vector needs to grow, it grows by its capacityincrement. If no capacity increment is specified, Java doubles the size of the Vector each timeadditional capacity is required. The default capacity is 10 elements. 970Summary 943

...

Class instance creation expressions beginning with keyword new create new objects.

...

Classes ObjectInputStream and ObjectOutputStream, which respectively implement theObjectInput and ObjectOutput interfaces, enable entire objects to be read from or written to astream (possibly a file). 756Terminology 729

...

Classes often provide public methods to allow clients of the class to set or get private instancevariables. The names of these methods need not begin with set or get, but this naming conventionis highly recommended in Java and is required for special Java software components called Java-Beans.

...

Classes that can be used to instantiate objects are called concrete classes. Such classes provide implementationsof every method they declare (some of the implementations can be inherited).

...

Counter-controlled repetition is often called definite repetition, because the number of repetitionsis known before the loop begins executing.

...

Collections from the collections framework are unsynchronized. Synchronization wrappers areprovided for collections that can be accessed by multiple threads simultaneously.Section 19.13 Unmodifiable Collections

...

Collections method reverseOrder returns a Comparator object that can be used with sort tosort elements of a collection in reverse order.

...

Collectively, Java's packages are referred to as the Java class library, or the Java Application ProgrammingInterface (Java API).

...

Committing the transaction finalizes the database operation(s); all insertions, updates and deletionsperformed as part of the transaction cannot be reversed without performing a new databaseoperation.

...

Comparable objects have a compareTo method that must return 0 if the objects are equal, -1 if thefirst object is less than the second or 1 if the first object is greater than the second.

...

Computers store files on secondary storage devices such as hard disks.Section 14.2 Data Hierarchy

...

Condition objects allow you to specify multiple conditions on which threads may wait. Thus, itis possible to indicate to waiting threads that a specific condition object is now true by callingsignal or signallAll on that Condition object. With synchronized, there is no way to explicitlystate the condition on which threads are waiting, so there is no way to notify threads waiting onone condition that they may proceed without also notifying threads waiting on any other conditions.Section 23.11 Multithreading with GUI

...

Condition objects are associated with a specific Lock and are created by calling a Lock's newConditionmethod, which returns an object that implements the Condition interface (of package java.util.concurrent.locks). To wait on a condition object, the thread can call the Condition'sawait method. This immediately releases the associated Lock and places the thread in the waitingstate for that Condition. Other threads can then try to obtain the Lock.

...

Conditions in if statements can be formed by using the equality (== and !=) and relational (>,<, >= and <=) operators.

...

Connection method createStatement creates an object of type Statement. The program uses theStatement object to submit SQL statements to the database.

...

Connection method createStatement has an overloaded version that takes two arguments: theresult type and the result concurrency. The result type specifies whether the ResultSet's cursoris able to scroll in both directions or forward only and whether the ResultSet is sensitive tochanges. The result concurrency specifies whether the ResultSet can be updated with Result-Set's update methods.

...

Connection-oriented transmission is like the telephone system—you dial and are given a connectionto the telephone of the person with whom you wish to communicate. The connection ismaintained for the duration of your phone call, even when you are not talking.

...

Connectionless transmission with datagrams is similar to mail carried via the postal service. Alarge message that will not fit in one envelope can be broken into separate message pieces that areplaced in separate, sequentially numbered envelopes. All the letters are then mailed at once. Theycould arrive in order, out of order or not at all.

...

Constant variables (also called named constants or read-only variables) must be initialized beforethey are used and cannot be modified thereafter.

...

Constants can also be declared as public final static variables. Such constants are declaredwith all capital letters by convention to make them stand out in the program.Section 6.11 Scope of Declarations

...

Constructors and static methods cannot be declared abstract.

...

Constructors can specify parameters but cannot specify return types.

...

Conversion character b (or B) outputs the string representation of a boolean or Boolean. Theseconversion characters also output "true" for non-null references and "false" for null references.When conversion character B is used, the output is displayed in uppercase letters.

...

Conversion character h (or H) returns null for a null reference and a String representation ofthe hash-code value (in base 16) of the object. Hash codes are used to store and retrieve objectsin Hashtables and HashMaps. When conversion character H is used, the output is displayed in uppercaseletters.

...

Conversion character t (or T) requires the argument to be of type long, Long, Calendar or Date. 14831456 Chapter 29 Formatted OutputSection 29.8 Other Conversion Characters

...

Counter-controlled repetition requires a control variable (or loop counter), the initial value ofthe control variable, the increment (or decrement) by which the control variable is modified each 256Summary 229time through the loop (also known as each iteration of the loop) and the loop-continuation conditionthat determines whether looping should continue.

...

Counter-controlled repetition uses a variable called a counter (or control variable) to control thenumber of times a set of statements execute. Chapter 4 Control Statements: Part 1

...

Data in many sequential files cannot be modified without the risk of destroying other data in thefile. Therefore, records in a sequential-access file are not usually updated in place. Instead, theentire file is usually rewritten.Section 14.6 Object Serialization

...

Data items processed by computers form a data hierarchy that becomes larger and more complexin structure as we progress from bits to characters to fields, and so on.

...

Data stored in variables and arrays is temporary—the data is lost when a local variable goes outof scope or when the program terminates. Computers use files for long-term retention of largeamounts of data, even after the programs that created the data terminate.

...

Data type int is used to declare variables that will hold integer values. The range of values for anint is -2,147,483,648 to +2,147,483,647.

...

DatagramPacket method getAddress returns an InetAddress object containing informationabout the host computer from which the packet was sent. Method getPort returns an integerspecifying the port number through which the host computer sent the DatagramPacket. MethodgetLength returns an integer representing the number of bytes of data in a DatagramPacket.Method getData returns a byte array containing the data in a DatagramPacket.

...

DatagramPacket objects store packets of data that are to be sent or that are received by an application.DatagramSockets send and receive DatagramPackets.

...

DatagramSocket method send sends a DatagramPacket out over the network.

...

Declaring instance variables private, while providing non-private methods to manipulate andperform validation, helps enforce good software engineering. SummarySection 10.1 Introduction

...

Declaring instance variables with access modifier private is known as data hiding.

...

Depending on the operating system, higher-priority threads could postpone—possibly indefinitely—the execution of lower-priority threads. Such indefinite postponement is sometimes referredto more colorfully as starvation.Section 23.4 Creating and Executing Threads

...

Dividing two integers results in integer division—the calculation's fractional part is truncated.Section 4.9 Formulating Algorithms: Sentinel-Controlled Repetition

...

Division by zero is normally a logic error that, if undetected, would cause the program to fail orproduce invalid output.

...

Dynamic data structures can grow and shrink at execution time.

...

Each Statement object can open only one ResultSet object at a time. When a Statement returnsa new ResultSet, the Statement closes the prior ResultSet.

...

Each case can have multiple statements. The switch statement differs from other control statementsin that it does not require braces around multiple statements in a case.

...

Each catch block specifies in parentheses an exception parameter that identifies the exceptiontype the handler can process. The exception parameter's name enables the catch block to interactwith a caught exception object.

...

Each class declaration that begins with keyword public must be stored in a file that has exactlythe same name as the class and ends with the .java file-name extension.

...

Each class in the Java API belongs to a package that contains a group of related classes. Packageshelp manage the complexity of application components and facilitate software reuse.

...

Each column of a table represents a different attribute.

...

Each enum constant in an enum declaration is optionally followed by arguments which are passedto the enum constructor.

...

Each link in the root node refers to a child. The left child is the first node in the left subtree, andthe right child is the first node in the right subtree.

...

Every JPanel has a paintComponent method, which the system automatically calls every time itneeds to display the JPanel—when a JPanel is first displayed on the screen, when it is coveredthen uncovered by a window on the screen and when the window in which it appears is resized.

...

Every Java thread has a thread priority (from MIN_PRIORITY to MAX_PRIORITY) that helps the operatingsystem determine the order in which threads are scheduled.

...

Every array object knows its own length and maintains this information in a length field. Theexpression array.length accesses array's length field to determine the length of the array.Section 7.3, Declaring and Creating Arrays

...

Every class declaration contains keyword class followed immediately by the class's name.

...

Every class in Java has the methods of class Object, one of which is the finalize method.

...

Every class must have at least one constructor. If none are provided, the compiler creates a defaultconstructor that initializes the instance variables to the initial values specified in their declarationsor to their default values.

...

Every class you declare represents a new type in Java.

...

Every column in a primary key must have a value, and the value of the primary key must beunique. This is known as the Rule of Entity Integrity.

...

Every method's body is delimited by left and right braces ({ and }).

...

Every object in Java knows its own class and can access this information through method get-Class, which all classes inherit from class Object. Method getClass returns an object of typeClass (package java.lang), which contains information about the object's type, including itsclass name.

...

Every object of a subclass is also an object of that class's superclass. However, a superclass objectis not an object of its class's subclasses.

...

Every operating system provides a mechanism to determine the end of a file, such as an end-offilemarker or a count of the total bytes in the file that is recorded in a system-maintained administrativedata structure.

...

Every package name should start with your Internet domain name in reverse order. After the domainname is reversed, you can choose any other names you want for your package.

...

Every primitive value and object in Java has a String representation. When an object is concatenatedwith a String, the object is converted to a String, then the two Strings are concatenated.

...

Every program is formed by combining as many sequence, selection and repetition statements asis appropriate for the algorithm the program implements.

...

Every statement ends with a semicolon.

...

Exception handling enables programmers to create applications that can resolve exceptions.Section 13.2 Exception-Handling Overview

...

Exception handling enables programmers to remove error-handling code from the "main line"of the program's execution, improving program clarity and enhancing modifiability.Section 13.3 Example: Divide by Zero without Exception Handling

...

Exception handling is designed to process synchronous errors, which occur when a statement executes.

...

Exception handling is not designed to process problems associated with asynchronous events,which occur in parallel with, and independent of, the program's flow of control.Section 13.6 Java Exception Hierarchy

...

Exceptions are rethrown when a catch block, upon receiving an exception, decides either that itcannot process that exception or that it can only partially process it. Rethrowing an exceptiondefers the exception handling (or perhaps a portion of it) to another catch block.

...

Exceptions are thrown when a method detects a problem and is unable to handle it.

...

Exceptions may surface through explicitly mentioned code in a try block, through calls to othermethods or even through deeply nested method calls initiated by code in the try block.

...

ExecutorService method execute executes its Runnable sometime in the future. The method returnsimmediately from each invocation—the program does not wait for each task to finish.

...

ExecutorService method shutdown notifies the ExecutorService to stop accepting new tasks,but continues executing tasks that have already been submitted. Once all of the previously submittedRunnables have completed, the ExecutorService terminates.Section 23.5 Thread Synchronization

...

Executors can reuse existing threads to eliminate the overhead of creating a new thread for eachtask and can improve performance by optimizing the number of threads to ensure that the processorstays busy.

...

Executors method newCachedThreadPool returns an ExecutorService that creates new threadsas they are needed by the application.

...

Experience has shown that the best way to develop and maintain a large program is to constructit from small, simple pieces, or modules. This technique is called divide and conquer.Section 6.2 Program Modules in Java

...

Field widths can be used with all conversion characters except the line-separator conversion.

...

Files that are created using byte-based streams are binary files. Files created using character-basedstreams are text files. Text files can be read by text editors, whereas binary files are read by a programthat converts the data to a human-readable format.

...

Floating-point values are printed with the conversion characters e (or E) for exponential notation,f for regular floating-point notation, and g (or G) for either e (or E) notation or f notation. Whenthe g conversion specifier is indicated, the e conversion character is used if the value is less than10-3 or greater than or equal to 107; otherwise, the f conversion character is used. When the conversioncharacters E and G are used, the output is displayed in uppercase letters.Section 29.6 Printing Strings and Characters

...

Floating-point values that appear in source code are known as floating-point literals and are typedouble by default.

...

For debugging, it is sometimes useful to repeat the same sequence of pseudorandom numbersduring each program execution to prove that your application is working for a specific sequenceof random numbers before testing the program with different sequences of random numbers.When repeatability is important, you can create a Random object by passing a long integer valueto the constructor. If the same seed is used every time the program executes, the Random objectproduces the same sequence of random numbers. You can also set a Random object's seed at anytime by calling the object's setSeed method.Section 6.10 Case Study: A Game of Chance (Introducing Enumerations)

...

For every enum, the compiler generates a static method called values that returns an array ofthe enum's constants in the order in which they were declared.

...

For primitive values used in string concatenation, the JVM handles the conversion of the primitivevalues to Strings. If a boolean is concatenated with a String, the word "true" or the word"false" is used to represent the boolean value. If there are any trailing zeros in a floating-pointvalue, these will be discarded when the number is concatenated to a String.

...

For recursion to eventually terminate, each time a method calls itself with a simpler version ofthe original problem, the sequence of smaller and smaller problems must converge on a base case.When, the method recognizes the base case, it returns a result to the previous copy of the method.

...

For searching and sorting algorithms, Big O is often dependent on how many elements are inthe data.

...

Format specifiers begin with a percent sign (%) and are followed by a character that represents the(-) data type. The format specifier %s is a placeholder for a string.

...

Fractals have a self-similar property—subparts are reduced-size copies of the whole.Section 15.9 Recursive Backtracking

...

Generic classes enable programmers to specify, with a single class declaration, a set of related types.

...

Generic classes provide a means for describing a class in a type-independent manner. We canthen instantiate type-specific objects of the generic class.

...

Generic methods and classes are among Java's most powerful capabilities for software reuse withcompile-time type safety.Section 18.2 Motivation for Generic Methods

...

Generic methods enable programmers to specify, with a single method declaration, a set of relatedmethods.

...

Graphics method drawLine draws a line between two points represented by its four arguments.The first two arguments are the x- and y-coordinates for one endpoint of the line, and the lasttwo arguments are the coordinates for the other endpoint of the line.

...

Graphics method drawRect requires four arguments. The first two represent the x- and y-coordinatesof the upper-left corner of the rectangle; the next two represent the width and the heightof the rectangle.

...

Graphics methods drawRect and drawOval draw rectangles and ovals, respectively.

...

HashMap is a generic class that takes two type arguments. The first type argument specifies thetype of key, and the second the type of value.

...

HashMap method keySet returns a set of the keys. Map methods size and isEmpty return the numberof key-value pairs in the Map and a boolean indicating whether the Map is empty, respectively.

...

HashMap method put adds a key and a value into a HashMap. Method get locates the value associatedwith the specified key. Method isEmpty determines whether the map is empty.

...

Hashtables and HashMaps store elements in hash tables, and TreeMaps store elements in trees.

...

If a method contains a local variable with the same name as one of its class's fields, the local variableshadows the field in the method's scope. The method can use the this reference to refer tothe shadowed field explicitly.Section 8.5 Time Class Case Study: Overloaded Constructors

...

If a recursive method is called with a more complex problem than a base case, it typically dividesthe problem into two conceptual pieces—a piece that the method knows how to do and a piecethat the method does not know how to do.

...

If a thread calls Condition method signalAll, then all the threads waiting for that conditiontransition to the runnable state and become eligible to reacquire the Lock.

...

If a thread calls notifyAll, then all the threads waiting for the monitor lock become eligible toreacquire the lock (that is, they all transition to the runnable state).Section 23.9 Producer/Consumer Relationship: Bounded Buffers

...

If a thread obtains the monitor lock on an object, then determines that it cannot continue withits task on that object until some condition is satisfied, the thread can call Object method wait;this releases the monitor lock on the object, and the thread waits in the waiting state while theother threads try to enter the object's synchronized statement(s) or method(s).

...

If a thread that owns a Lock determines that it cannot continue with its task until some conditionis satisfied, the thread can wait on a condition object. Using Lock objects allows you to explicitlydeclare the condition objects on which a thread may need to wait.

...

If a wildcard is specified without an upper bound, then only the methods of type Object can beinvoked on values of the wildcard type.

...

If an application must perform a lengthy computation in response to a user interface interaction,the event dispatch thread cannot attend to other tasks in the event queue while the thread is tiedup in that computation. This causes the GUI components to become unresponsive. It is preferableto handle a long-running computation in a separate thread, freeing the event dispatch threadto continue managing other GUI interactions.

...

If an error occurs when receiving or sending a DatagramPacket, an IOException occurs.Section 24.9 Security and the Network

...

If an exception occurs in a try block, the try block terminates immediately and program controltransfers to the first of the following catch blocks whose exception parameter type matches thetype of the thrown exception.

...

If an exception that occurs in the try block cannot be caught by one of that try block's associatedcatch handlers, the program skips the rest of the try block and control proceeds to the finallyblock, which releases the resource. Then the program passes to the next outer try block—normallyin the calling method.

...

If an expression contains nested parentheses, the innermost set of parentheses is evaluated first.

...

If an operation requires the executing thread to hold a lock while the operation is performed, athread must acquire the lock before it can proceed with the operation. Any other threads attemptingto perform an operation that requires the same lock will be blocked until the first threadreleases the lock, at which point the blocked threads may attempt to acquire the lock.

...

If multiple threads are in a Condition's waiting state when signal is called, the default implementationof Condition signals the longest-waiting thread to transition to the runnable state.

...

If no access modifier is specified for a method or variable when it is declared in a class, the methodor variable is considered to have package access. SummarySection 9.1 Introduction

...

If no constructor is provided for a class, the compiler provides a default constructor with no parameters.

...

If no match occurs between the controlling expression's value and a case label, the optionaldefault case executes. If no match occurs and the switch does not contain a default case, programcontrol simply continues with the first statement after the switch.

...

If no memory is available, an OutOfMemoryError is thrown.Section 17.6 Linked Lists

...

If several threads are trying to call method lock on the same Lock object at the same time, onlyone thread can obtain the lock—all other threads attempting to obtain that Lock are placed inthe waiting state. When a thread calls method unlock, the lock on the object is released and awaiting thread attempting to lock the object proceeds.

...

If the argument to setAutoCommit is false, the program must follow the last SQL statement inthe transaction with a call to Connection method commit (to commit the changes to the database)or Connection method rollback (to return the database to its state prior to the transaction).

...

If the field width is larger than the object being printed, the object is right justified in the field.

...

If the initialization expression in the for header declares the control variable, the control variablecan be used only in that for statement—it will not exist outside the for statement.

...

If the loop-continuation condition is initially false, the program does not execute the for statement'sbody. Instead, execution proceeds with the statement following the for.Section 5.4 Examples Using the for Statement

...

If the operations performed by several overloaded methods are identical for each argument type,the overloaded methods can be more compactly and conveniently coded using a generic method.You can write a single generic method declaration, which can be called with arguments of differ- 917890 Chapter 18 Genericsent data types. Based on the types of the arguments passed to the generic method, the compilerhandles each method call appropriately.

...

If the size of the array is doubled, binary search requires only one extra comparison to completesuccessfully.Section 16.3 Sorting Algorithms

...

In a binary search tree with no duplicate values, the values in any left subtree are less than thevalue in the subtree's parent node, and the values in any right subtree are greater than the valuein the subtree's parent node. A node can be inserted only as a leaf node in a binary search tree.

...

In a multithreaded producer/consumer relationship, a producer thread generates data and placesit in a shared object called a buffer. A consumer thread reads data from the buffer.

...

In a postorder traversal, the value in each node is processed after the values of its children.

...

In a preorder traversal, the value in each node is processed as the node is visited. Then the valuesin the left subtree are processed, and then the values in the right subtree.

...

In addition to creating threads to run a program, the JVM also may create threads for performinghousekeeping tasks such as garbage collection.Section 23.2 Thread States: Life Cycle of a Thread

...

In addition to selection and repetition statements, Java provides statements break and continue(presented in this section and Appendix K, Labeled break and continue Statements) to alter theflow of control. The preceding section showed how break can be used to terminate a switchstatement's execution. This section discusses how to use break in repetition statements.

...

In most cases, the for statement can be represented with an equivalent while statement as follows:initialization;while ( loopContinuationCondition ){statementincrement;}

...

In most cases, you can avoid using logical negation by expressing the condition differently withan appropriate relational or equality operator.Section 5.10 (Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals

...

In most operating systems, each thread is given a small amount of processor time—called a quantumor timeslice—with which to perform its task. When the thread's quantum expires, thethread returns to the ready state and the operating system assigns another thread to the processor.

...

In sentinel-controlled repetition, a special value called a sentinel value (also called a signal value,a dummy value or a flag value) is used to indicate "end of data entry."

...

In single inheritance, a class is derived from one direct superclass. In multiple inheritance, a classis derived from more than one direct superclass. Java does not support multiple inheritance.

...

In some applications, using Lock and Condition objects may be preferable to using the synchronizedkeyword. Lock objects allow you to interrupt waiting threads or to specify a timeout forwaiting to acquire a lock, which is not possible using the synchronized keyword. Also, a Lockobject is not constrained to be acquired and released in the same block of code, which is the casewith the synchronized keyword.

...

In some cases, it is useful to declare classes for which you never intend to instantiate objects. Suchclasses are called abstract classes. Because they are used only as superclasses in inheritance hierarchies,we refer to them as abstract superclasses. These classes cannot be used to instantiate objects,because they are incomplete.

...

In the UML, each class is modeled in a class diagram as a rectangle with three compartments.The top compartment contains the name of the class centered horizontally in boldface. The middlecompartment contains the class's attributes, which correspond to fields in Java. The bottomcompartment contains the class's operations, which correspond to methods and constructors inJava.

...

In the context of an application, the principle of least privilege states that code should be grantedonly the amount of privilege and access that the code needs to accomplish its designated task.

...

In the worst case, the first call to merge sort has to make O(n) comparisons to fill the n slots inthe final array.

...

Including an abstract method in a superclass forces every direct subclass of the superclass to overridethe abstract method in order to become a concrete class. This enables the designer of the classhierarchy to demand that each concrete subclass provide an appropriate method implementation.

...

InetAddress method getByName returns an InetAddress object containing the host name of thecomputer for which the host name or IP address is specified as an argument. InetAddress methodgetLocalHost returns an InetAddress object containing the host name of the local computerexecuting the program.Section 24.7 Connectionless Client/Server Interaction with Datagrams

...

Input and output are usually performed with streams, which are sequences of bytes. In input operations,the bytes flow from a device to main memory. In output operations, bytes flow frommain memory to a device.

...

Insertions are made at the tail of a queue and deletions are made from the head.

...

Integer division yields an integer quotient.

...

Integers are printed with the conversion characters d for decimal integers, o for integers in octalform and x (or X) for integers in hexadecimal form. When the conversion character X is used, theoutput is displayed in uppercase letters.Section 29.5 Printing Floating-Point Numbers

...

Integers are whole numbers, such as -22, 7, 0 and 1024.

...

Java applies the operators in arithmetic expressions in a precise sequence determined by the rulesof operator precedence.

...

Interface Collection is the root interface in the collection hierarchy from which interfaces Setand List are derived. Interface Collection contains bulk operations for adding, clearing, comparingand retaining objects in a collection. Interface Collection provides a method iteratorfor getting an Iterator.

...

Interface Executor declares method execute, which accepts a Runnable as an argument and assignsit to one of the available threads in the thread pool. If there are no available threads, theExecutor creates a new thread or waits for a thread to become available.

...

Interface ExecutorService (of package java.util.concurrent) extends interface Executor anddeclares other methods for managing the life cycle of an Executor.

...

Interface ExecutorService provides the awaitTermination method to force a program to waitfor threads to complete execution. This method returns control to its caller either when all tasksexecuting in the ExecutorService complete or when the specified timeout elapses. If all tasks arecompleted before awaitTermination times out, this method returns true; otherwise it returnsfalse. The two arguments to awaitTermination represent a timeout value and a unit of measurespecified with a constant from class TimeUnit.

...

Interface List is implemented by classes ArrayList, LinkedList and Vector. Class ArrayList isa resizable-array implementation of a List. A LinkedList is a linked list implementation of aList.

...

Interface PreparedStatement enables you to create compiled SQL statements that execute moreefficiently than Statement objects.

...

Interface PreparedStatement provides set methods for each supported SQL type.

...

Interface RowSet configures the database connection and executes the query automatically.

...

Interface Runnable declares method run in which you place the code that defines the task to perform.The thread executing a Runnable calls method run to perform the task.

...

Interface SortedMap extends Map and represents a map that maintains its keys in sorted order.Class TreeMap implements SortedMap.Section 19.11 Properties Class

...

Interface SortedSet extends Set and represents a set that maintains its elements in sorted order.Class TreeSet implements SortedSet.

...

Interfaces define and standardize the ways in which things such as people and systems can interactwith one another.

...

It is not necessary to use braces in the do...while repetition statement if there is only one statementin the body. However, most programmers include the braces, to avoid confusion betweenthe while and do...while statements.Section 5.6 switch Multiple-Selection Statement

...

It is possible to instantiate a generic class without specifying a type argument. In this case, thenew object of the class is said to have a raw type, which means that the compiler implicitly usestype Object (or the type parameter's upper bound) throughout the generic class for each typeargument.Section 18.8 Wildcards in Methods That Accept Type Parameters

...

Iteration and recursion each involve a termination test: Iteration terminates when the loop-continuationcondition fails, recursion when a base case is recognized.

...

Iteration with counter-controlled repetition and recursion each gradually approach termination:Iteration keeps modifying a counter until the counter assumes a value that makes the loop-continuationcondition fail, whereas recursion keeps producing simpler versions of the original problemuntil the base case is reached.

...

Iterator method hasNext determines whether a Collection contains another element. Methodnext returns a reference to the next object in the Collection and advances the Iterator.

...

JDBC enables programs to invoke stored procedures using objects that implement interfaceCallableStatement.

...

JEditorPane method setPage downloads the document specified by its argument and displays itin the JEditorPane.

...

JFrame method add attaches a GUI component to a JFrame.

...

JFrame method setDefaultCloseOperation with the argument JFrame.EXIT_ON_CLOSE indicatesthat the application should terminate when the user closes the window. 203176 Chapter 4 Control Statements: Part 1

...

JFrame method setSize sets the width and height of the JFrame. SummarySection 5.2 Essentials of Counter-Controlled Repetition

...

JPanel methods getWidth and getHeight return the width and height of a JPanel, respectively.

...

Java DB has both an embedded version and a network version.Section 25.11 PreparedStatements

...

Java SE 6 provides class SwingWorker (in package javax.swing), which implements the Runnableinterface, to perform long-running computations in a worker thread and to update Swing componentsfrom the event dispatch thread based on the computations' results.

...

Java allows several methods of the same name to be declared in a class, as long as the methodshave different sets of parameters (determined by the number, order and types of the parameters).This technique is called method overloading.

...

Java also can associate streams with different devices. Three stream objects are associated withdevices when a Java program begins executing—System.in, System.out and System.err.

...

Math.PI and Math.E are declared with the modifiers public, final and static. Making thempublic allows other programmers to use these fields in their own classes. Any field declared withkeyword final is constant—its value cannot be changed after the field is initialized. Both PI andE are declared final because their values never change. Making these fields static allows themto be accessed via the class name Math and a dot (.) separator, just like class Math's methods.

...

Math.pow(x, y) calculates the value of x raised to the yth power. The method receives two doublearguments and returns a double value.

...

Merge sort is a sorting algorithm that is faster, but more complex to implement, than selectionsort and insertion sort.

...

Merge sort performs the merge by looking at the first element in each array, which is also thesmallest element in the array. Merge sort takes the smallest of these and places it in the first elementof the larger array. If there are still elements in the subarray, merge sort looks at the secondelement in that subarray (which is now the smallest element remaining) and compares it to thefirst element in the other subarray. Merge sort continues this process until the larger array is filled.

...

Merge sort's base case is an array with one element. A one-element array is already sorted, somerge sort immediately returns when it is called with a one-element array. The merge part ofmerge sort takes two sorted arrays (these could be one-element arrays) and combines them intoone larger sorted array.

...

Method add of class ArrayList appends an element to the end of the collection.

...

Method arguments may be constants, variables or expressions.

...

Method clear removes elements from a List.

...

Method doInBackground is called from a worker thread. After doInBackground returns, methoddone is called from the event dispatch thread to display the results.

...

Method doubleValue of class Number obtains the Number's underlying primitive value as a doublevalue.

...

Method getAutoCommit determines the autocommit state for the Connection. SummarySection 29.2 Streams

...

Method getConnection of class DriverManager attempts to connect to a database specified by itsURL argument. The URL helps the program locate the database. The URL includes the protocolfor communication, the subprotocol for communication and the name of the database.

...

Method getStackTrace obtains the stack-trace information as an array of StackTraceElementobjects. Each StackTraceElement represents one method call on the method-call stack.

...

Method paintComponent requires one argument, a Graphics object, that is provided for you bythe system when it calls paintComponent.

...

Method process executes in the event dispatch thread and receives data from method publish.The passing of values between publish in the worker thread and process in the event dispatchthread is asynchronous; process is not necessarily invoked for every call to publish.

...

Method put places an element at the end of the BlockingQueue, waiting if the queue is full.Method take removes an element from the head of the BlockingQueue, waiting if the queue isempty. These methods make class ArrayBlockingQueue a good choice for implementing a sharedbuffer. Because method put blocks until there is room in the buffer to write data and methodtake blocks until there is new data to read, the producer must produce a value first, the consumercorrectly consumes only after the producer writes a value and the producer correctly producesthe next value (after the first) only after the consumer reads the previous (or first) value.

...

Method setAutoCommit specifies whether each SQL statement commits after it completes (a trueargument) or if several SQL statements should be grouped as a transaction (a false argument).

...

Method setString automatically escapes String parameter values as necessary.

...

Method size gets the number of items in a List, and method get returns a List element.Section 19.4 Interface Collection and Class Collections

...

Method subList returns a view of a portion of a List. Any changes made to this view are alsomade to the List.

...

Method submit returns an object of type Future (of package java.util.concurrent) that representsthe executing Callable. Interface Future declares method get to return the result of theCallable and provides other methods to manage a Callable's execution. SummarySection 24.1 Introduction

...

Method toArray returns the contents of a collection as an array.

...

Most instance variable declarations are preceded with the private access modifier. Variables ormethods declared with access modifier private are accessible only to methods of the class inwhich they are declared.

...

Most method calls are resolved at execution time, based on the type of the object being manipulated.This process is known as dynamic binding or late binding.

...

Most operating systems enable threads of equal priority to share a processor with timeslicing.

...

Most programs perform arithmetic calculations. The arithmetic operators are + (addition), -(subtraction, * (multiplication), / (division) and % (remainder).

...

Multidimensional arrays are maintained as arrays of separate one-dimensional arrays. As a result,the lengths of the rows in a two-dimensional array are not required to be the same.

...

Multidimensional arrays with two dimensions are often used to represent tables of values consistingof information arranged in rows and columns.

...

Multiple columns can be used for ordering purposes with an ORDER BY clause of the formORDER BY column1 sortingOrder, column2 sortingOrder, ...

...

Multiprogramming involves the simultaneous operation of many jobs.

...

Normally, statements in a program are executed one after the other in the order in which theyare written. This process is called sequential execution.

...

Not all inheritance hierarchies contain abstract classes. However, programmers often write clientcode that uses only abstract superclass types to reduce client code's dependencies on a range ofspecific subclass types.

...

Objects of class Random (package java.util) can produce random int, long, float or double values.Math method random can produce double values in the range 0.0 =x < 1.0, where x is thevalue returned by method random.

...

One way to describe the efficiency of an algorithm is with Big O notation, which indicates howhard an algorithm may have to work to solve a problem.

...

Only classes that implement interface Serializable can be serialized and deserialized with ObjectOutputStreamsand ObjectInputStreams.Section 14.7 Additional java.io Classes

...

Operations on the buffer data shared by a producer and a consumer are state dependent—theyshould proceed only if the buffer is in the correct state. If the buffer is in a not-full state, the producermay produce; if the buffer is in a not-empty state, the consumer may consume.

...

Overloaded constructors enable objects of a class to be initialized in different ways. The compilerdifferentiates overloaded constructors by their signatures.Section 8.6 Default and No-Argument Constructors

...

Overloaded methods are distinguished by their signatures—combinations of the methods'names and the number, types and order of their parameters. Methods cannot be distinguishedby return type. SummarySection 7.1, Introduction

...

Overloaded methods are often used to perform similar operations on different types of data.

...

Package java.sql contains classes and interfaces for accessing relational databases in Java.

...

Packages provide a convention for unique class names that helps prevent class name conflicts.

...

Parameter numbers are counted from 1, starting with the first question mark (?).

...

Passing arguments to main in a Java application from the command line is achieved by includinga parameter of type String[] in the parameter list of main. By convention, main's parameter isnamed args.

...

Performing a task in a program requires a method. Inside the method you put the mechanismsthat make the method do its tasks—that is, the method hides the implementation details of thetasks that it performs.

...

Persistent data maintained in files exists beyond the duration of program execution.

...

Programs use variables of reference types (called references) to store the location of an object inthe computer's memory. Such variables refer to objects in the program. The object that is referencedmay contain many instance variables and methods.

...

Properties method setProperty specifies the value associated with the key argument. Propertiesmethod getProperty locates the value of the key specified as an argument. Method storesaves the contents of the Properties object to the OutputStream object specified as the first argument.Method load restores the contents of the Properties object from the InputStream objectspecified as the argument.Section 19.12 Synchronized Collections

...

PropertyChangeListener is an interface from package java.beans that defines a single method,propertyChange. Every time method setProgress is invoked, a PropertyChangeEvent is generatedto indicate that the progress property has changed.Section 23.12 Other Classes and Interfaces in java.util.concurrent

...

Pseudocode helps the programmer "think out" a program before attempting to write it in a programminglanguage, such as Java.

...

Pseudocode is an informal language that helps programmers develop algorithms without havingto worry about the strict details of Java language syntax.

...

Pseudocode is similar to everyday English—it is convenient and user friendly, but it is not anactual computer programming language.

...

Queue nodes are removed only from the head of the queue and are inserted only at the tail. Forthis reason, a queue is referred to as a first-in, first-out (FIFO) data structure.

...

Queue, a new collection interface introduced in Java SE 5, extends interface Collection and providesadditional operations for inserting, removing and inspecting elements in a queue.

...

Queues have many uses in computer systems. Most computers have only a single processor, soonly one application at a time can be serviced. Entries for the other applications are placed in aqueue. The entry at the front of the queue is the next to receive service. Each entry gradually advancesto the front of the queue as applications receive service.Section 17.9 Trees

...

Random method nextInt generates a random int value in the range -2,147,483,648 to+2,147,483,647. The values returned by nextInt are actually pseudorandom numbers—a sequenceof values produced by a complex mathematical calculation. That calculation uses the currenttime of day to seed the random-number generator such that each execution of a programyields a different sequence of random values.

...

Random numbers can be chosen from nonconsecutive integer ranges, as innumber = shiftingValue +differenceBetweenValues * randomNumbers.nextInt( scalingFactor ); 311284 Chapter 6 Methods: A Deeper Lookwhere shiftingValue specifies the first number in the range of values, differenceBetweenValues representsthe difference between consecutive numbers in the sequence and scalingFactor specifieshow many numbers are in the range.

...

Random numbers in a range can be generated withnumber = shiftingValue + randomNumbers.nextInt( scalingFactor );where shiftingValue specifies the first number in the desired range of consecutive integers, andscalingFactor specifies how many numbers are in the range.

...

Rectangles with their upper-right corners folded over are UML notes—explanatory remarks thatdescribe the purpose of symbols in the diagram.

...

Recursion repeatedly invokes the mechanism, and consequently the overhead, of method calls.

...

Redundant parentheses in an expression can make an expression clearer. 10376 Chapter 2 Introduction to Java ApplicationsSection 2.8 Decision Making: Equality and Relational Operators

...

Reference-type fields are initialized by default to the value null.

...

ResultSet get methods typically receive as an argument either a column number (as an int) or acolumn name (as a String) indicating which column's value to obtain.

...

ResultSet method absolute positions the ResultSet cursor at a specific row.

...

ResultSet method next positions the ResultSet cursor to the next row in the ResultSet. Thecursor points to the current row. Method next returns boolean value true if it is able to positionto the next row; otherwise, the method returns false. This method must be called to begin processinga ResultSet. 1262Summary 1235

...

ResultSet row and column numbers start at 1.

...

ResultSetMetaData method getColumnClassName obtains the fully qualified class name of thespecified column.

...

ResultSetMetaData method getColumnCount retrieves the number of ResultSet columns.

...

ResultSetMetaData method getColumnName obtains the column name from the ResultSet.

...

Rolling back a transaction leaves the database in its state prior to the database operation. This isuseful when a portion of a transaction fails to complete properly.

...

SQL is the international standard language used almost universally with relational database systemsto perform queries and manipulate data.

...

SQL provides a rich set of language constructs that enable you to define complex queries to retrievedata from a database.

...

SQL uses single quotes (') as the delimiter for strings. To specify a string containing a singlequote in SQL, the single quote must be escaped with another single quote.Section 25.4.6 UPDATE Statement

...

Scanner method hasNext determines whether there is more data to input. This method returnsthe boolean value true if there is more data; otherwise, it returns false. As long as the end-offileindicator has not been typed, method hasNext will return true.

...

Searching a binary tree for a value that matches a key value is also fast, especially for tightlypacked trees. In a tightly packed tree, each level contains about twice as many elements as theprevious one. So a tightly packed binary search tree with n elements has log2 n levels, and thus atmost log2 n comparisons would have to be made either to find a match or to determine that nomatch exists. Searching a (tightly packed) 1000-element binary search tree requires at most 10comparisons, because 210 > 1000. Searching a (tightly packed) 1,000,000-element binary searchtree requires at most 20 comparisons, because 220 > 1,000,000. SummarySection 18.1 Introduction

...

Searching data involves determining whether a search key is present in the data and, if so, findingits location.

...

Selection sort is a simple, but inefficient, sorting algorithm.

...

Set methods are commonly called mutator methods because they typically change a value. Getmethods are commonly called accessor methods or query methods. A predicate method testswhether a condition is true or false.Section 8.8 Composition

...

Since the compiler knows that final methods cannot be overridden, it can optimize programsby removing calls to final methods and replacing them with the expanded code of their declarationsat each method-call location—a technique known as inlining the code.

...

Single-entry/single-exit control statements make it easy to build programs—we "attach" the controlstatements to one another by connecting the exit point of one to the entry point of the next.This is known as control-statement stacking.

...

Single-inheritance relationships form tree-like hierarchical structures—a superclass exists in a hierarchicalrelationship with its subclasses.Section 9.3 protected Members

...

Socket methods getOutputStream and getInputStream get references to a Socket's Output-Stream and InputStream, respectively. Socket method close terminates a connection.Section 24.5 Establishing a Simple Client Using Stream Sockets

...

Software is constructed from existing, well-defined, carefully tested, well-documented, portable,widely available components. Software reusability speeds the development of powerful, highqualitysoftware. Rapid application development (RAD) is of great interest today.

...

Software reuse reduces program-development time.

...

Some JDBC drivers do not support scrollable or updatable ResultSets.Section 25.8.2 Querying the books Database

...

Some recursive solutions, such as Fibonacci (which makes two calls per recursion step), result inan "explosion" of method calls. 793766 Chapter 15 RecursionSection 15.5 Recursion and the Method-Call Stack

...

Sometimes a runnable thread transitions to the waiting state while it waits for another thread toperform a task. A waiting thread transitions back to the runnable state only when another threadnotifies it to continue executing.

...

Sorting involves arranging data into order.Section 16.2 Searching Algorithms

...

Specifying the order in which statements execute in a program is called program control.Section 4.3 Pseudocode

...

StackTraceElement methods getClassName, getFileName, getLineNumber and getMethodNameget the class name, file name, line number and method name, respectively.Section 13.10 Chained Exceptions

...

Stacks are important in compilers and operating systems—insertions and deletions are made onlyat one end of a stack, its top. 862Summary 835

...

Stacks are known as last-in, first-out (LIFO) data structures—the last item pushed (inserted) onthe stack is the first item popped (removed) from the stack.

...

Stacks are used by compilers to evaluate arithmetic expressions and generate machine-languagecode to process the expressions.

...

Stacks have many interesting applications. For example, when a program calls a method, thecalled method must know how to return to its caller, so the return address of the calling methodis pushed onto the program execution stack (sometimes referred to as the method-call stack).

...

Stacks have many interesting applications. When a method call is made, the called method mustknow how to return to its caller, so the return address is pushed onto the program executionstack. If a series of method calls occurs, the successive return values are pushed onto the stack inlast-in, first-out order so that each method can return to its caller. The program execution stackcontains the space created for local variables on each invocation of a method. When the methodreturns to its caller, the space for that method's local variables is popped off the stack, and thosevariables are no longer available to the program. 863836 Chapter 17 Data Structures

...

Statement method executeQuery executes a query and returns an object that implements interfaceResultSet containing the query result. ResultSet methods enable a program to manipulatequery results.

...

Static variables have class scope. A class's public static members can be accessed through a referenceto any object of the class, or they can be accessed by qualifying the member name withthe class name and a dot (.). A class's private static class members can be accessed onlythrough methods of the class.

...

Stream-based connections are managed with Socket objects.

...

String class static method format is similar to method System.out.printf except that formatreturns a formatted String rather than displaying it in a command window. 446Summary 419

...

Strings can be concatenated using operator +, which places the characters of the right operandat the end of those in the left operand.

...

Swing GUI components are not thread safe. Thread safety in GUI applications is achieved byensuring that Swing components are accessed from only the event dispatch thread. This techniqueis called thread confinement.

...

Swing applications have a thread, called the event dispatch thread, to handle interactions withthe application's GUI components. All tasks that require interaction with an application's GUIare placed in an event queue and are executed sequentially by the event dispatch thread.

...

SwingWorker also provides methods publish, process and setProgress. Method publish repeatedlysends intermediate results to method process, which displays the results in a GUI component.Method setProgress updates the progress property.

...

SwingWorker is a generic class. Its first type parameter indicates the type returned by the doIn-Background method; the second indicates the type that is passed between the publish and processmethods to handle intermediate results.

...

Syntax errors are caught by the compiler.

...

System class static method gc indicates that the garbage collector should make a best-effort attemptto reclaim objects that are eligible for garbage collection.

...

TableModel method getColumnClass returns a Class object that represents the superclass of allobjects in a particular column. JTable uses this information to set up the default cell rendererand cell editor for that column in a JTable.

...

TableModel method getColumnCount returns the number of columns in the model's underlyingResultSet.

...

TableModel method getColumnName returns the name of the column in the model's underlyingResultSet.

...

The Ada programming language, developed by the United States Department of Defense, madeconcurrency primitives widely available to defense contractors building military command-andcontrolsystems.

...

The Callable interface (of package java.util.concurrent) declares a single method namedcall. This interface is designed to be similar to the Runnable interface—allowing an action to beperformed concurrently in a separate thread—but the call method allows the thread to returna value or to throw a checked exception.

...

The Collections API provides a set of public static methods for converting collections to unmodifiableversions. Unmodifiable wrappers throw UnsupportedOperationExceptions if attemptsare made to modify the collection.Section 19.14 Abstract Implementations

...

The Comparator interface provides a means of sorting a Collection's elements in an order otherthan their natural order.

...

The DatagramPacket constructor for a packet to be sent takes four arguments—the byte array tobe sent, the number of bytes to be sent, the client address to which the packet will be sent andthe port number where the client is waiting to receive packets.

...

The DatagramSocket constructor that takes no arguments binds the application to a port chosenby the computer on which the program executes. The DatagramSocket constructor that takes aninteger port number argument binds the application to the specified port. If a DatagramSocketconstructor fails to bind the application to a port, a SocketException occurs. DatagramSocketmethod receive blocks (waits) until a packet arrives, then stores the packet in its argument. 1196Terminology 1169

...

The Fibonacci series begins with 0 and 1 and has the property that each subsequent Fibonaccinumber is the sum of the preceding two.

...

The HTTP protocol (Hypertext Transfer Protocol) that forms the basis of the web uses URIs(Uniform Resource Identifiers) to locate data on the Internet. Common URIs represent files ordirectories and can represent complex tasks such as database lookups and Internet searches. AURI that represents a document is called a URL (Uniform Resource Locator).

...

The Java Collections Framework provides many generic data structures and algorithms that manipulatethe elements of those data structures. Perhaps the simplest of the data structures is classArrayList—a dynamically resizable, array-like data structure.

...

The Java Virtual Machine (JVM) performs automatic garbage collection to reclaim the memoryoccupied by objects that are no longer in use. When there are no more references to an object,the object is marked for garbage collection by the JVM. The memory for such an object can bereclaimed when the JVM executes its garbage collector.

...

The Java collections framework gives the programmer access to prepackaged data structures aswell as to algorithms for manipulating them.Section 19.2 Collections Overview

...

The Java compiler always associates an else with the immediately preceding if unless told to dootherwise by the placement of braces ({ and }). This behavior can lead to what is referred to asthe dangling-else problem.

...

The UML models operations by listing the operation name followed by a set of parentheses. Aplus sign (+) in front of the operation name indicates that the operation is a public operation inthe UML (i.e., a public method in Java).Section 3.4 Declaring a Method with a Parameter

...

The UML represents instance variables as attributes by listing the attribute name, followed by acolon and the attribute type.

...

The UML type String corresponds to the Java type String.Section 3.5 Instance Variables, set Methods and get Methods

...

The UML's merge symbol joins two flows of activity into one.

...

The WHERE and ORDER BY clauses can be combined in one query. If used, ORDER BY must be thelast clause in the query.Section 25.4.4 Merging Data from Multiple Tables: INNER JOIN

...

The WHERE clause can contain operators <, >, <=, >=, =, <> and LIKE. Operator LIKE is used forstring pattern matching with wildcard characters percent (%) and underscore (_).

...

The activity diagram for the single-selection if statement contains the diamond, or decisionsymbol, which indicates that a decision is to be made. The workflow will continue along a pathdetermined by the symbol's associated guard conditions, which can be true or false. Each transitionarrow emerging from a decision symbol has a guard condition. If a guard condition is true,the workflow enters the action state to which the transition arrow points.

...

The amount of memory in a computer is finite, so only a certain amount of memory can be usedto store activation records on the program execution stack. If there are more method calls thancan have their activation records stored on the program execution stack, an error known as a stackoverflow occurs. The application will compile correctly, but its execution causes a stack overflow.Section 6.7 Argument Promotion and Casting

...

The arrows in an activity diagram represent transitions, which indicate the order in which theactions represented by the action states occur.

...

The assignment operator, =, enables the program to give a value to a variable. Operator = is calleda binary operator because it has two operands. An assignment statement uses an assignment operatorto assign a value to a variable.

...

The basic form of a query isSELECT * FROM tableNamewhere the asterisk (*) indicates that all columns from tableName should be selected, and tableNamespecifies the table in the database from which rows will be retrieved.

...

The binary search algorithm is more efficient than the linear search algorithm, but it requires thatthe array be sorted.

...

The binary search tree facilitates duplicate elimination. As the tree is created, attempts to inserta duplicate value are recognized, because a duplicate follows the same "go left" or "go right" decisionson each comparison as the original value did. Thus, the duplicate eventually is comparedwith a node containing the same value. The duplicate value can be discarded at this point.

...

The body of a method contains statements that perform the method's task. After the statementsexecute, the method has completed its task.

...

The boolean logical AND (&) and boolean logical inclusive OR (|) operators work identically tothe && (conditional AND) and || (conditional OR) operators, with one exception: The booleanlogical operators always evaluate both of their operands (i.e., they do not perform short-circuitevaluation).

...

The break statement is not required for the switch's last case (or the optional default case,when it appears last), because execution continues with the next statement after the switch.Section 5.7 break and continue Statements

...

The break statement, when executed in a while, for, do...while or switch, causes immediateexit from that statement. Execution continues with the first statement after the control statement.

...

The children of a node are called siblings. A node with no children is called a leaf node.

...

The class from which the new class inherits is called the superclass and the new class is called thesubclass.

...

The classes and interfaces of the collections framework are in package java.util.Section 19.3 Class Arrays

...

The classpath for the compiler and JVM can be specified by providing the -classpath option tothe javac or java command, or by setting the CLASSPATH environment variable. The classpathfor the JVM can also be specified via the -cp command-line option. If classes must be loadedfrom the current directory, include a dot (.) in the classpath.Section 8.17 Package Access

...

The client of a class cares about the functionality the class offers, but not about how the functionalityis implemented. This is referred to as data abstraction. Although programmers may know the 448Terminology 421details of a class's implementation, they should not write code that depends on these details. Thisenables a class to be replaced with another version without affecting the rest of the system.

...

The collections framework provides various abstract implementations of collection interfacesfrom which the programmer can quickly flesh out complete customized implementations. SummarySection 23.1 Introduction

...

The comma (,) formatting flag in a format specifier (e.g., %,20.2f) indicates that a floating-pointvalue should be output with a grouping separator. The actual separator used is specific to the user'slocale (i.e., country). For example, in the United States, the number will be output usingcommas to separate every three digits and a decimal point to separate the fractional part of thenumber, as in 1,234.45.

...

The common PriorityQueue operations are offer to insert an element at the appropriate locationbased on priority order, poll to remove the highest-priority element of the priority queue(i.e., the head of the queue), peek to get a reference to the highest-priority element of the priorityqueue, clear to remove all elements in the priority queue and size to get the number of elementsin the priority queue. 971944 Chapter 19 CollectionsSection 19.9 Sets

...

The compiler produces a separate file with the .class extension for every compiled class.

...

The compiler uses a class loader to locate the classes it needs in the classpath. The classpath consistsof a list of directories or archive files, each separated by a directory separator.

...

The computer's character set is the set of all characters used to write programs and represent data.

...

The conditional operator (?:) can be used in place of an if...else statement. This is Java's onlyternary operator—it takes three operands. Together, the operands and the ?: symbol form a conditionalexpression.

...

The constructor for a ReentrantLock takes a boolean argument that specifies whether the lockhas a fairness policy. If the argument is true, the ReentrantLock's fairness policy is "the longestwaitingthread will acquire the lock when it is available." This guarantees that indefinite postponement(also called starvation) cannot occur. If the fairness policy argument is set to false,there is no guarantee as to which waiting thread will acquire the lock when it is available. 11411114 Chapter 23 Multithreading

...

The continue statement, when executed in a while, for or do...while, skips the remaining statementsin the loop body and proceeds with the next iteration of the loop. In while and do...whilestatements, the program evaluates the loop-continuation test immediately after the continuestatement executes. In a for statement, the increment expression executes, then the programevaluates the loop-continuation test.Section 5.8 Logical Operators

...

The conversion character % is used to display a literal %.Section 29.9 Printing with Field Widths and Precisions

...

The conversion character n prints the platform-specific line separator.

...

The conversion character s (or S) prints a string of characters. When the conversion character Sis used, the output is displayed in uppercase letters.Section 29.7 Printing Dates and Times

...

The conversion character t (or T) followed by a conversion suffix character prints the date andtime in various forms. When the conversion character T is used, the output is displayed in uppercaseletters.

...

The data components of a class are attributes or fields; the operation components are methods.

...

The decision and merge symbols can be distinguished by the number of "incoming" and "outgoing"transition arrows. A decision symbol has one transition arrow pointing to the diamondand two or more transition arrows pointing out from the diamond to indicate possible transitionsfrom that point. Each transition arrow pointing out of a decision symbol has a guard condition.A merge symbol has two or more transition arrows pointing to the diamond and only one transitionarrow pointing from the diamond, to indicate multiple activity flows merging to continuethe activity. None of the transition arrows associated with a merge symbol has a guard condition.Section 4.8 Formulating Algorithms: Counter-Controlled Repetition

...

The default value for a field of type String is null.

...

The default value for a field of type double is 0.0, and the default value for a field of type int is 0. SummarySection 4.1 Introduction

...

The direct superclass of a subclass (specified by the keyword extends in the first line of a classdeclaration) is the superclass from which the subclass inherits. An indirect superclass of a subclassis two or more levels up the class hierarchy from that subclass.

...

The do...while repetition statement is similar to the while statement. In the while, the programtests the loop-continuation condition at the beginning of the loop, before executing the loop'sbody; if the condition is false, the body never executes. The do...while statement tests the loopcontinuationcondition after executing the loop's body; therefore, the body always executes atleast once. When a do...while statement terminates, execution continues with the next statementin sequence.

...

The empty statement is a statement that does not perform a task. SummarySection 3.2 Classes, Objects, Methods and Instance Variables

...

The end-of-file indicator is a system-dependent keystroke combination which the user enters toindicate that there is no more data to input. On UNIX/Linux/Mac OS X systems, end-of-file isentered by typing the sequence <ctrl> d on a line by itself. This notation means to simultaneouslypress both the ctrl key and the d key. On Windows systems, end-of-file can be entered by typing<ctrl> z.

...

The enhanced for statement allows programmers to iterate through the elements of an array ora collection without using a counter. The syntax of an enhanced for statement is:for ( parameter : arrayName )statementwhere parameter has two parts—a type and an identifier (e.g., int number), and arrayName is thearray through which to iterate.

...

The enhanced for statement cannot be used to modify elements in an array. If a program needsto modify elements, use the traditional counter-controlled for statement.Section 7.7, Passing Arrays to Methods

...

The expression new Scanner( System.in ) creates a Scanner that reads from the keyboard. Thestandard input object, System.in, enables Java applications to read data typed by the user.

...

The field width and the precision can be combined by placing the field width, followed by a decimalpoint, followed by the precision between the percent sign and the conversion character.Section 29.10 Using Flags in the printf Format String

...

The finalize method is called by the garbage collector just before it reclaims the object's memory.Method finalize does not take parameters and has return type void.

...

The finally block is optional. If it is present, it is placed after the last catch block.

...

The first element in every array has index zero and is sometimes called the zeroth element.

...

The first iteration of binary search tests the middle element in the array. If this is the search key,the algorithm returns its location. If the search key is less than the middle element, binary searchcontinues with the first half of the array. If the search key is greater than the middle element,binary search continues with the second half of the array. Each iteration of binary search tests themiddle value of the remaining array and, if the element is not found, eliminates half of the remainingelements.

...

The first iteration of insertion sort takes the second element in the array and, if it is less than thefirst element, swaps it with the first element. The second iteration of insertion sort looks at thethird element and inserts it in the correct position with respect to the first two elements. Afterthe ith iteration of insertion sort, the first i elements in the original array are sorted.

...

The first iteration of selection sort selects the smallest item in the array and swaps it with the firstelement. The second iteration of selection sort selects the second-smallest item (which is the 829802 Chapter 16 Searching and Sortingsmallest remaining item) and swaps it with the second element. Selection sort continues until thelast iteration selects the second-largest element and swaps it with the second-to-last element, leavingthe largest element in the last index. At the ith iteration of selection sort, the smallest i itemsof the whole array are sorted into the first i indices.

...

The first statement in every paintComponent method you create should always besuper.paintComponent( g );This ensures that the panel is properly rendered on the screen before you begin drawing on it.

...

The first task of any subclass constructor is to call its direct superclass's constructor, either explicitlyor implicitly, to ensure that the instance variables inherited from the superclass are initializedproperly. 496Terminology 469

...

The for repetition statement specifies the details of counter-controlled-repetition in a single lineof code.

...

The foreign key helps maintain the Rule of Referential Integrity: Every foreign-key value mustappear as another table's primary-key value. Foreign keys enable information from multiple tablesto be joined together. There is a one-to-many relationship between a primary key and itscorresponding foreign key. 1260Summary 1233Section 25.4.1 Basic SELECT Query

...

The format specifier %20s indicates that the String output should be displayed with a field widthof 20—that is, printf displays the value with at least 20 character positions. If the value to beoutput is less than 20 character positions wide, the value is right justified in the field by default.

...

The format specifier %d is a placeholder for an int value.Section 2.6 Memory Concepts

...

The format specifier %f is used to output values of type float or double. A precision can be specifiedbetween % and f to represent the number of decimal places that should be output to theright of the decimal point in the floating-point number.

...

The garbage collector may never execute before a program terminates. Thus, it is unclear whether,or when, method finalize will be called.Section 8.11 static Class Members

...

The general format of the for statement isfor ( initialization; loopContinuationCondition; increment )statementwhere the initialization expression names the loop's control variable and optionally provides itsinitial value, loopContinuationCondition is the condition that determines whether the loopshould continue executing and increment modifies the control variable's value (possibly an incrementor decrement), so that the loop-continuation condition eventually becomes false. The twosemicolons in the for header are required.

...

The if single-selection statement performs an indicated action only when the condition is true.

...

The if statement is a single-entry/single-exit control statement.Section 4.6 if...else Double-Selection Statement

...

The if statement is a single-selection statement because it selects or ignores a single action or asingle group of actions.

...

The if statement normally expects only one statement in its body. To include several statementsin the body of an if (or the body of an else for an if...else statement), enclose the statementsin braces ({ and }).

...

The if...else double-selection statement performs one action when the condition is true and adifferent action when the condition is false.

...

The if...else statement is called a double-selection statement because it selects between two differentactions or groups of actions.

...

The increment expression in a for acts as if it were a standalone statement at the end of the for'sbody.

...

The increment of a for statement may also be negative, in which case it is really a decrement,and the loop counts downward.

...

The insert and remove operations for a queue are known as enqueue and dequeue.

...

The instanceof operator can be used to determine whether a particular object's type has the isarelationship with a specific type.

...

The java.io package includes definitions for stream classes, such as FileInputStream (for bytebasedinput from a file), FileOutputStream (for byte-based output to a file), FileReader (forcharacter-based input from a file) and FileWriter (for character-based output to a file). Files areopened by creating objects of these stream classes.Section 14.4 Class File

...

The job of an operating system's thread scheduler is to determine which thread runs next.

...

The key to using a bounded buffer with a producer and consumer that operate at about the samespeed is to provide the buffer with enough locations to handle the anticipated "extra" production.

...

The keyword extends indicates that a class inherits from another class. The new class begins withthe existing members (data and methods) from the existing class.

...

The limit for dynamic memory allocation can be as large as the available physical memory in thecomputer or the amount of available disk space in a virtual-memory system. Often, the limits aremuch smaller because the computer's available memory must be shared among many users.

...

The linear search algorithm runs in O(n) time.

...

The linear search algorithm searches each element in the array sequentially until it finds the correctelement. If the element is not in the array, the algorithm tests each element in the array, andwhen the end of the array is reached, informs the user that the element is not present. If the elementis in the array, linear search tests each item until it finds the correct item.

...

The merge sort algorithm sorts an array by splitting the array into two equal-sized subarrays, sortingeach subarray recursively and merging the subarrays into one larger array.

...

The merging portion of the merge sort algorithm is performed on two subarrays, each of approximatelysize n/2. Creating each of these subarrays requires n /2 - 1 comparisons for each subarray,or O(n) comparisons total. This pattern continues as each level works on twice as many arrays,but each is half the size of the previous array.

...

The names used for type parameters throughout the method declaration must match those declaredin the type parameter section. The name of a type parameter can be declared only once inthe type parameter section but can appear more than once in the method's parameter list. Typeparameternames need not be unique among different generic methods.

...

The number of arguments in the method call must match the number of parameters in the methoddeclaration's parameter list. Also, the argument types in the method call must be consistentwith the types of the corresponding parameters in the method's declaration.

...

The optional WHERE clause in a query specifies the selection criteria for the query. The basic formof a query with selection criteria isSELECT columnName1, columnName2, ... FROM tableName WHERE criteria

...

The package name is part of the fully qualified class name. This helps prevent name conflicts.

...

The parts of an expression containing && or || operators are evaluated only until it is knownwhether the condition is true or false. This feature of conditional AND and conditional OR expressionsis called short-circuit evaluation.

...

The point in the program at which an exception occurs is called the throw point.Section 13.4 Example: Handling ArithmeticExceptions and InputMismatchExceptions

...

The preferred means of creating multithreaded Java applications is by implementing interfaceRunnable (of package java.lang). A Runnable object represents a "task" that can execute concurrentlywith other tasks.

...

The primary key can be composed of more than one column.

...

The printf format string describes the formats in which the output values appear. The formatspecifier consists of argument index, flags, field widths, precisions and conversion characters.Section 29.4 Printing Integers

...

The process that an operating system uses to determine which thread to dispatch is called threadscheduling and is dependent on thread priorities (discussed in the next section).Section 23.3 Thread Priorities and Thread Scheduling

...

The program execution stack contains the memory for local variables on each invocation of amethod during a program's execution. This data, stored as a portion of the program executionstack, is known as the activation record or stack frame of the method call.

...

The program execution stack contains the memory for the local variables used in each invocationof a method during a program's execution. This data is known as the activation record or stackframe of the method call. When a method call is made, the activation record for that method callis pushed onto the program execution stack. When the method returns to its caller, the activationrecord for this method call is popped off the stack and those local variables are no longer knownto the program. If a local variable holding a reference to an object is the only variable in the programwith a reference to that object, when the activation record containing that local variable ispopped off the stack, the object can no longer be accessed by the program and will eventually bedeleted from memory by the JVM during "garbage collection."

...

The program unit that houses a method is called a class. A class may contain one or more methodsthat are designed to perform the class's tasks.

...

The public methods of a class are also known as the class's public services or public interface.The primary purpose of public methods is to present to the class's clients a view of the servicesthe class provides. Clients of the class need not be concerned with how the class accomplishes itstasks. For this reason, private class members are not directly accessible to the class's clients.

...

The purpose of an abstract class is primarily to provide an appropriate superclass from which otherclasses can inherit and thus share a common design. 546Summary 519

...

The ratio of successive Fibonacci numbers converges on a constant value of 1.618..., a numberthat has been called the golden ratio or the golden mean.

...

The result of a query can be sorted in ascending or descending order using the optional ORDER BYclause. The simplest form of an ORDER BY clause isSELECT columnName1, columnName2, ... FROM tableName ORDER BY column ASCSELECT columnName1, columnName2, ... FROM tableName ORDER BY column DESCwhere ASC specifies ascending order, DESC specifies descending order and column specifies the columnon which the sort is based. The default sorting order is ascending, so ASC is optional.

...

The scope of a local-variable declaration that appears in the initialization section of a for statement'sheader is the body of the for statement and the other expressions in the header.

...

The scope of a method or field of a class is the entire body of the class. This enables a class's methodsto use simple names to call the class's other methods and to access the class's fields.

...

The scope of a parameter declaration is the body of the method in which the declaration appears.

...

The selection sort algorithm runs in O(n2) time.

...

The sequence structure is built into Java. Unless directed otherwise, the computer executes Javastatements one after the other in the order in which they are written—that is, in sequence.

...

The simplest way to implement a bounded buffer is to use an ArrayBlockingQueue for the bufferso that all of the synchronization details are handled for you.Section 23.10 Producer/Consumer Relationship: The Lock and Condition Interfaces

...

The size of a "conventional" Java array cannot be altered—it is fixed at creation time.

...

The smallest data item in a computer can assume the value 0 or the value 1 and is called a bit.Ultimately, a computer processes all data items as combinations of zeros and ones.

...

The solid circle located at the top of an activity diagram represents the activity's initial state—the beginning of the workflow before the program performs the modeled actions.

...

The solid circle surrounded by a hollow circle that appears at the bottom of the diagram representsthe final state—the end of the workflow after the program performs its actions.

...

The space flag prints a space preceding a positive value. The space flag and the + flag cannot beused together in an integral conversion character.

...

The static method format of class String formats data and returns the formatted data as aString.

...

The switch multiple-selection statement performs different actions based on the possible valuesof an integer variable or expression. Each action is associated with the value of a constant integralexpression (i.e., a constant value of type byte, short, int or char, but not long) that the variableor expression on which the switch is based may assume.

...

The switch statement consists of a block that contains a sequence of case labels and an optionaldefault case.

...

The switch statement does not provide a mechanism for testing ranges of values, so every valuethat must be tested should be listed in a separate case label. 258Summary 231

...

The switch statement is called a multiple-selection statement because it selects among many differentactions or groups of actions.

...

The synchronized statements are declared using the synchronized keyword:synchronized ( object ){statements} // end synchronized statementwhere object is the object whose monitor lock will be acquired; object is normally this if it's theobject in which the synchronized statement appears.

...

The technique of implementing each stack method as a call to a List method is called delegation—the stack method invoked delegates the call to the appropriate List method.Section 17.8 Queues

...

The term "control structures" comes from the field of computer science. The Java Language Specificationrefers to "control structures" as "control statements." 199172 Chapter 4 Control Statements: Part 1

...

The this reference cannot be used in a static method.Section 8.12 static Import

...

The throws clause contains a comma-separated list of exceptions that the method will throw if aproblem occurs when the method executes.Section 13.5 When to Use Exception Handling

...

The while and for statements perform the action(s) in their bodies zero or more times—if theloop-continuation condition is initially false, the action(s) will not execute. The do...while statementperforms the action(s) in its body one or more times.

...

The while repetition statement allows the programmer to specify that a program should repeatan action while some condition remains true.

...

The while statement can be used to implement any counter-controlled loop.

...

The words if, else, switch, while, do and for are Java keywords. Keywords cannot be used asidentifiers, such as variable names.

...

There are three ways to call a method—using a method name by itself to call another method ofthe same class; using a variable that contains a reference to an object, followed by a dot (.) andthe method name to call a method of the referenced object; and using the class name and a dot(.) to call a static method of a class.

...

There are three ways to return control to a statement that calls a method. If the method does notreturn a result, control returns when the program flow reaches the method-ending right brace orwhen the statementreturn;is executed. If the method returns a result, the statementreturn expression;evaluates the expression, then immediately returns the resulting value to the caller.

...

There are two types of RowSets—connected and disconnected.

...

There is a special relationship between classes that are compiled in the same directory on disk.By default, such classes are considered to be in the same package—known as the default package.Classes in the same package are implicitly imported into the source code files of other classes in 148Summary 121the same package. Thus, an import declaration is not required when one class in a package usesanother in the same package.

...

There is only one other way in which control statements may be connected—control-statementnesting—in which a control statement appears inside another control statement.Section 4.5 if Single-Selection Statement

...

Though it is possible to create threads explicitly, it is recommended that you use the Executorinterface to manage the execution of Runnable objects for you. An Executor object typically createsand manages a group of threads called a thread pool to execute Runnables.

...

Threads with access to a buffer must be synchronized to ensure that data is written to the bufferor read from the buffer only if the buffer is in the proper state. If the producer attempting to putthe next data into the buffer determines that the buffer is full, the producer thread should waituntil there is space. If a consumer thread finds the buffer empty or finds that the previous datahas already been read, the consumer must also wait for new data to become available.Section 23.7 Producer/Consumer Relationship: ArrayBlockingQueue

...

To call a method of an object, follow the variable name with a dot separator (.), the methodname and a set of parentheses containing the method's arguments.

...

To create an array object, the programmer specifies the type of the array elements and the numberof elements as part of an array-creation expression that uses keyword new. The following array-creation expression creates an array of 100 int values:int b[] = new int[ 100 ];

...

To display a JPanel on the screen, you must place it in a window. You create a window with anobject of class JFrame from package javax.swing.

...

To enable assertions at runtime, use the -ea switch when running the java command. SummarySection 14.1 Introduction

...

To ensure that either or both of two conditions are true before choosing a certain path of execution,use the || (conditional OR) operator, which evaluates to true if either or both of its simpleconditions are true.

...

To ensure that two conditions are both true before choosing a certain path of execution, use the&& (conditional AND) operator. This operator yields true if and only if both of its simple conditionsare true. If either or both of the simple conditions are false, the entire expression is false.

...

To facilitate the retrieval of specific records from a file, at least one field in each record is chosenas a record key. A record key identifies a record as belonging to a particular person or entity andis unique to each record.

...

To make recursion feasible, the piece that the method does not know how to do must resemblethe original problem, but be a slightly simpler or smaller version of it. Because this new problemlooks like the original problem, the method calls a fresh copy of itself to work on the smallerproblem—this is called the recursion step.

...

To pass an individual array element to a method, use the indexed name of the array as an argumentin the method call.Section 7.9, Multidimensional Arrays

...

To pass an object reference to a method, simply specify in the method call the name of the variablethat refers to the object.

...

To perform a floating-point calculation with integer values, cast one of the integers to type double.Using a cast operator in this manner is called explicit conversion.

...

To refer to a particular element in an array, we specify the name of the reference to the array andthe index (subscript) of the element in the array.

...

To retrieve data sequentially from a file, programs normally start reading from the beginning ofthe file and read all the data consecutively until the desired information is found.

...

To retrieve specific columns from a table, replace the asterisk (*) with a comma-separated list ofcolumn names.

...

To specify that a thread must hold a monitor lock in order to execute a block of code, the codeshould be placed in a synchronized statement. Such code is said to be guarded by the monitorlock; a thread must acquire the lock to execute the synchronized statements. 11391112 Chapter 23 Multithreading

...

To use SwingWorker's capabilities, create a class that extends SwingWorker and overrides themethods doInBackground and done. Method doInBackground performs the computation and returnsthe result. Method done displays the results in the GUI. 1142Terminology 1115

...

To use an interface, a concrete class must specify that it implements the interface and must declareeach interface method with the signature specified in the interface declaration. A class that doesnot implement all the interface's methods is an abstract class and must be declared abstract.

...

Today's most popular database management systems are relational database systems.

...

Top-down, stepwise refinement is essential to the development of well-structured programs.

...

Types float and double specify real numbers, and type char specifies character data. Real numbersare numbers that contain decimal points, such as 3.4, 0.0 and -11.19. Variables of typechar data represent individual characters, such as an uppercase letter (e.g., A), a digit (e.g., 7), aspecial character (e.g., * or %) or an escape sequence (e.g., the newline character, \n).

...

Types in Java are divided into two categories—primitive types and reference types (sometimescalled nonprimitive types). The primitive types are boolean, byte, char, short, int, long, floatand double. All other types are reference types, so classes, which specify the types of objects, arereference types. 149122 Chapter 3 Introduction to Classes and Objects

...

Types such as int, float, double and char are often called primitive types or built-in types.Primitive-type names are keywords; thus, they must appear in all lowercase letters.

...

Typically, an HTML document contains hyperlinks—text, images or GUI components that,when clicked, link to another document on the web. If an HTML document is displayed in aJEditorPane and the user clicks a hyperlink, the JEditorPane generates a HyperlinkEvent andnotifies all registered HyperlinkListeners of the event.

...

Typically, for statements are used for counter-controlled repetition and while statements forsentinel-controlled repetition.

...

Typically, several fields compose a record (implemented as a class in Java).

...

Typically, you cannot call a method that belongs to another class until you create an object ofthat class.

...

UML class diagrams do not specify return types for operations that do not return values.Section 3.6 Primitive Types vs. Reference Types

...

Unlike checked exceptions, the Java compiler does not check the code to determine whether anunchecked exception is caught or declared. Unchecked exceptions typically can be prevented byproper coding.

...

Using existing methods as building blocks to create new programs is a form of software reusabilitythat allows you to avoid repeating code within a program.Section 6.3 static Methods, static Fields and Class Math

...

Using recursion to return to an earlier decision point is known as recursive backtracking. If oneset of recursive calls does not result in a solution to the problem, the program backs up to the previousdecision point and makes a different decision, often resulting in another set of recursive calls. SummarySection 16.1 Introduction

...

Using the postfix increment or decrement operator to add or subtract 1 is known as postincrementingor postdecrementing, respectively.

...

Using the prefix increment or decrement operator to add or subtract 1 is known as preincrementingor predecrementing, respectively.

...

Variable names correspond to locations in the computer's memory. Every variable has a name, atype, a size and a value.

...

Variables declared in the body of a particular method are known as local variables and can beused only in that method.

...

Variables of type float represent single-precision floating-point numbers and have seven significantdigits. Variables of type double represent double-precision floating-point numbers. Theserequire twice as much memory as float variables and provide 15 significant digits—approximatelydouble the precision of float variables.

...

Variables should be declared as fields of a class only if they are required for use in more than onemethod of the class or if the program should save their values between calls to the class's methods.Section 6.5 Notes on Declaring and Using Methods

...

Variables should be initialized to prepare them for use in a program.

...

Various Java statements enable the programmer to specify that the next statement to execute isnot necessarily the next one in sequence. This is called transfer of control.

...

Various exception classes can be derived from a common superclass. If a catch block is writtento catch exception objects of a superclass type, it can also catch all objects of that class's subclasses.This allows for polymorphic processing of related exceptions.Section 13.7 finally block

...

Vector method add adds its argument to the end of the Vector. Method insertElementAt insertsan element at the specified position. Method set sets the element at a specific position.

...

Vector method contains determines whether the Vector contains the searchKey specified as anargument. Vector method indexOf gets the index of the first location of its argument. The methodreturns -1 if the argument is not found in the Vector.

...

Vector method firstElement returns a reference to the first element. Method lastElement returnsa reference to the last element.

...

Vector method isEmpty determines whether the Vector is empty. Methods size and capacitydetermine the number of elements currently in the Vector and the number of elements that canbe stored in the Vector without allocating more memory, respectively.Section 19.6 Collections Algorithms

...

Vector method remove removes the first occurrence of its argument from the Vector. MethodremoveAllElements removes every element from the Vector. Method removeElementAt removesthe element at the specified index.

...

Web browsers often restrict an applet so that it can communicate only with the machine fromwhich it was originally downloaded. SummarySection 25.1 Introduction

...

When a Java program executes, the JVM checks array indices to ensure that they are valid (i.e.,they must be greater than or equal to 0 and less than the length of the array). If a program usesan invalid index, Java generates a so-called exception to indicate that an error occurred in the programat execution time.Section 7.6, Enhanced for Statement

...

When a class has only the default constructor, its instance variables are initialized to their defaultvalues. Variables of types char, byte, short, int, long, float and double are initialized to 0, variablesof type boolean are initialized to false, and reference-type variables are initialized to null.

...

When a generic class is compiled, the compiler performs erasure on the class's type parametersand replaces them with their upper bounds.

...

When a higher-priority thread enters the ready state, the operating system generally preempts thecurrently running thread (an operation known as preemptive scheduling).

...

When a large String literal is typed into a program's source code, programmers sometimes breakthat String into several smaller Strings and place them on multiple lines of code for readability,then reassemble the Strings using concatenation. 310Summary 283Section 6.6 Method-Call Stack and Activation Records

...

When a method has more than one parameter, the parameters are specified as a comma-separatedlist. There must be one argument in the method call for each parameter in the method declaration.Also, each argument must be consistent with the type of the corresponding parameter. If amethod does not accept arguments, the parameter list is empty.

...

When a method is called, the program makes a copy of the method's argument values and assignsthem to the method's corresponding parameters, which are created and initialized when themethod is called. When program control returns to the point in the program where the methodwas called, the method's parameters are removed from memory.

...

When a method that specifies a return type is called and completes its task, the method returnsa result to its calling method.

...

When a recursive method is called to solve a problem, the method actually is capable of solvingonly the simplest case(s), or base case(s). If it is called with a base case, the method returns a result.Section 15.2 Recursion Concepts

...

When a rethrow occurs, the next enclosing try block detects the rethrown exception, and thattry block's catch blocks attempt to handle the exception.

...

When a runnable thread completes a task and determines that the waiting thread can now continue,the runnable thread can call Condition method signal to allow a thread in that Condition'swaiting state to return to the runnable state. At this point, the thread that transitionedfrom the waiting state to the runnable state can attempt to reacquire the Lock.

...

When a subclass method overrides a superclass method, the superclass method can be accessedfrom the subclass if the superclass method name is preceded by the keyword super and a dot (.)separator.Section 9.4 Relationship between Superclasses and Subclasses

...

When a thread executing a synchronized statement (or method) completes or satisfies the conditionon which another thread may be waiting, it can call Object method notify to allow a waitingthread to transition to the runnable state again. At this point, the thread that was transitionedfrom the wait state to the runnable state can attempt to reacquire the monitor lock on the object.

...

When a thread is finished with a shared object, it must call method unlock to release the Lock.

...

When an argument is passed by reference, the called method can access the argument's value inthe caller directly and possibly modify it.

...

When an argument is passed by value, a copy of the argument's value is made and passed to thecalled method. The called method works exclusively with the copy.

...

When an argument to a method is an entire array or an individual array element of a referencetype, the called method receives a copy of the array or element's reference. When an argumentto a method is an individual array element of a primitive type, the called method receives a copyof the element's value.

...

When an array is created, each element of the array receives a default value—zero for numericprimitive-type elements, false for boolean elements and null for references (any nonprimitivetype).

...

When an array is declared, the type of the array and the square brackets can be combined at thebeginning of the declaration to indicate that all the identifiers in the declaration are array variables,as indouble[] array1, array2;

...

When an exception is thrown but not caught in a particular scope, the method-call stack is unwound,and an attempt is made to catch the exception in the next outer try statement. This processis called stack unwinding.Section 13.9 printStackTrace, getStackTrace and getMessage

...

When an object is output using the %s format specifier, the object's toString method is calledimplicitly to obtain its string representation.Section 9.5 Constructors in Subclasses

...

When compiling a class in a package, the javac command-line option -d specifies where to storethe package and causes the compiler to create the package's directories if they do not exist.

...

When designing your own methods, you should state the preconditions and postconditions in acomment before the method declaration.Section 13.13 Assertions

...

When drawing an oval, an imaginary rectangle called a bounding rectangle is created, and an ovalthat touches the midpoints of all four sides of the bounding rectangle is placed inside. MethoddrawOval requires the same four arguments as method drawRect. The arguments specify the positionand size of the bounding rectangle for the oval. SummarySection 6.1 Introduction

...

When each object of a class maintains its own copy of an attribute, the field that represents theattribute is also known as an instance variable. Each object (instance) of the class has a separateinstance of the variable in memory.

...

When incrementing or decrementing a variable in a statement by itself, the prefix and postfixincrement forms have the same effect, and the prefix and postfix decrement forms have the sameeffect.Section 4.13 Primitive Types

...

When instantiating an object of a generic class, the types specified in angle brackets after the classname are known as type arguments. The compiler uses them to replace the type parameters sothat it can perform type checking and insert cast operations as necessary.Section 18.7 Raw Types

...

When multiple threads share an object and one or more of them modify that object, indeterminateresults may occur unless access to the shared object is managed properly. The problem canbe solved by giving only one thread at a time exclusive access to code that manipulates the sharedobject. During that time, other threads desiring to manipulate the object are kept waiting. Whenthe thread with exclusive access to the object finishes manipulating it, one of the threads that waswaiting is allowed to proceed. This process, called thread synchronization, coordinates access toshared data by multiple concurrent threads.

...

When objects of a class containing static fields (class variables) are created, all the objects of thatclass share one copy of the class's static fields. Together the class variables and instance variablesrepresent the fields of a class. You will learn more about static fields in Section 8.11.

...

When processing ResultSets, it is possible to extract each column of the ResultSet as a specificJava type. ResultSetMetaData method getColumnType returns a constant integer from class Types(package java.sql) indicating the type of the data for a specific column.

...

When the compiler encounters a method call made through a variable, the compiler determinesif the method can be called by checking the variable's class type. If that class contains the propermethod declaration (or inherits one), the call is compiled. At execution time, the type of the objectto which the variable refers determines the actual method to use.Section 10.4 Abstract Classes and Methods

...

When the compiler encounters a method call, it attempts to locate a method declaration that hasthe same method name and parameters that match the argument types in the method call.Section 18.3 Generic Methods: Implementation and Compile-Time Translation

...

When the compiler encounters a method call, it determines the argument types and attempts tolocate a method with the same name and parameters that match the argument types. If there isno such method, the compiler determines whether there is an inexact but applicable match.

...

When the compiler encounters a method call, it performs a matching process to determine whichmethod to call. The compiler tries to find and use a precise match in which the method namesand argument types of the method call match those of a specific method declaration. If this fails,the compiler determines whether a generic method is available that provides a precise match ofthe method name and argument types, and if so, uses that generic method. 918Summary 891Section 18.6 Generic Classes

...

When the compiler performs erasure on a method that returns a type variable, it also inserts explicitcast operations in front of each method call to ensure that the returned value is of the typeexpected by the caller.Section 18.5 Overloading Generic Methods

...

When the compiler translates a generic method into Java bytecodes, it removes the type parametersection and replaces the type parameters with actual types. This process is known as erasure.By default each type parameter is replaced with its upper bound. By default, the upper bound istype Object unless specified otherwise in the type parameter section.Section 18.4 Additional Compile-Time Translation Issues: Methods That Use a TypeParameter as the Return Type

...

When the flow of control reaches the switch, the program evaluates the controlling expressionof the switch. The program compares the value of the controlling expression (which must evaluateto an integral value of type byte, char, short or int) with each case label. If a match occurs,the program executes the statements for that case.

...

When the for statement begins executing, its control variable is declared and initialized. Next,the program checks the loop-continuation condition. If the condition is initially true, the bodyexecutes. After executing the loop's body, the increment expression executes. Then the loop-continuationtest is performed again to determine whether the program should continue with thenext iteration of the loop.

...

When we say that operators are applied from left to right, we are referring to their associativity.Some operators associate from right to left.

...

When you attempt to execute a class, Java looks for the class's main method to begin execution.

...

When you execute the Java Virtual Machine (JVM) with the java command, the JVM attemptsto invoke the main method of the class you specify. The JVM loads the class specified by Class- 309282 Chapter 6 Methods: A Deeper LookName and uses that class name to invoke method main. You can specify an optional list of Strings(separated by spaces) as command-line arguments that the JVM will pass to your application.

...

When you share immutable data across threads, you should declare the corresponding data fieldsfinal to indicate that variables' values will not change after they are initialized.Section 23.6 Producer/Consumer Relationship Without Synchronization

...

Whenever a value is placed in a memory location, the value replaces the previous value in thatlocation. The previous value is lost.Section 2.7 Arithmetic

...

Wildcard type arguments enable you to specify method parameters, return values, variables, etc.that act as supertypes of parameterized types. A wildcard type argument is denoted by the questionmark (?), which represents an "unknown type." A wildcard can also have an upper bound.

...

With a BufferedInputStream, many "logical" chunks of data from a file are read as one largephysical input operation into a memory buffer. As a program requests each new chunk of data,it is taken from the buffer. When the buffer is empty, the next actual physical input operationfrom the input device is performed to read in the next group of "logical" chunks of data. SummarySection 15.1 Introduction

...

With datagram sockets, individual packets of information are transmitted. UDP (User DatagramProtocol) is a connectionless service that does not guarantee that packets will not be lost, duplicatedor arrive out of sequence. Extra programming is required on your part to deal with theseproblems.Section 24.2 Manipulating URLs

...

With polymorphism, we can design and implement systems that are easily extensible—new classescan be added with little or no modification to the general portions of the program, as long asthe new classes are part of the inheritance hierarchy that the program processes generically. Theonly parts of a program that must be altered to accommodate new classes are those that requiredirect knowledge of the new classes that the programmer adds to the hierarchy.Section 10.3 Demonstrating Polymorphic Behavior

...

Within an application, programmers may state conditions that they assumed to be true at a particularpoint. These conditions, called assertions, help ensure a program's validity by catching potentialbugs and indentifying possible logic errors.

...

Without break statements, each time a match occurs in the switch, the statements for that caseand subsequent cases execute until a break statement or the end of the switch is encountered.This is often referred to as "falling through" to the statements in subsequent cases.

...

You can create an interface that describes the desired functionality, then implement the interfacein any classes that require that functionality.

...

You can declare a variable and initialize it in the same statement.Section 5.3 for Repetition Statement

...

You can implement a shared buffer yourself using the synchronized keyword and Object methodswait, notify and notifyAll, which can be used with conditions to make threads wait whenthey cannot perform their tasks.

...

You can place a main method in every class you declare—only the main method in the class youuse to execute the application will be called. Some programmers take advantage of this to builda small test program into each class they declare.Section 6.4 Declaring Methods with Multiple Parameters

...

You can simulate atomicity by ensuring that only one thread carries out a set of operations at atime. Atomicity can be achieved using the synchronized keyword to create a synchronized statementor synchronized method.

...

You cannot make assumptions about the relative speeds of concurrent threads—interactions thatoccur with the operating system, the network, the user and other components can cause thethreads to operate at different speeds. When this happens, threads wait.

...

You cannot predict the order in which threads will be scheduled, even if you know the order inwhich they were created and started.

...

You make a class abstract by declaring it with keyword abstract. An abstract class normally containsone or more abstract methods.

...

You process query results by knowing in advance the order of the columns in the result. Specifyingcolumns explicitly guarantees that they are always returned in the specified order, even ifthe actual order in the table(s) is different.Section 25.4.2 WHERE Clause

...

enum constants are implicitly static.

...

enum constants can be used anywhere constants can be used, such as in the case labels of switchstatements and to control enhanced for statements.

...

enum types are implicitly final, because they declare constants that should not be modified.

...

static class members exist even when no objects of the class exist—they are available as soon asthe class is loaded into memory at execution time. To access a private static member when noobjects of the class exist, a public static method must be provided.

...

A Java class name is an identifier—a series of characters consisting of letters, digits, underscores( _ ) and dollar signs ($) that does not begin with a digit and does not contain spaces. Normally,an identifier that does not begin with a capital letter is not the name of a Java class.

...

A backslash (\) in a string is an escape character. It indicates that a "special character" is to beoutput. Java combines the next character with the backslash to form an escape sequence. The escapesequence \n represents the newline character, which positions the cursor on the next line.Section 2.4 Displaying Text with printf

...

A comment that begins with // is called an end-of-line (or single-line) comment because thecomment terminates at the end of the line on which it appears.

...

A computer consists of various devices referred to as hardware. The programs that run on a computerare referred to as software.Section 1.3 Computer Organization

...

A computer is a device capable of performing computations and making logical decisions atspeeds millions (even billions) of times faster than human beings can.

...

A programming language's syntax specifies the rules for creating a proper program in that language.

...

A public class declaration must be saved in a file with the same name as the class followed by the".java" file-name extension. 10174 Chapter 2 Introduction to Java Applications

...

A sequence of characters in double quotation marks is called a string, a character string, a messageor a string literal.

...

A syntax error (also called a compiler error, compile-time error or compilation error) occurs whenthe compiler encounters code that violates Java's language rules.

...

An instance of a class is called an object.

...

Any computer can directly understand only its own machine language.

...

BASIC was developed in the mid-1960s for writing simple programs.

...

By convention, all class names in Java begin with a capital letter and capitalize the first letter ofeach word they include (e.g., SampleClassName).

...

C++, an extension of C, was developed by Bjarne Stroustrup in the early 1980s at Bell Laboratories.C++ provides a number of features that "spruce up" the C language, and capabilities forobject-oriented programming.Section 1.9 History of Java

...

COBOL (COmmon Business Oriented Language) is used for commercial applications that requireprecise and efficient manipulation of large amounts of data.

...

Classes can have relationships with other classes; these relationships are called associations.

...

Computer programmers create applications by writing computer programs. A Java application isa computer program that executes when you use the java command to launch the JVM.

...

Computers process data under the control of sets of instructions called computer programs. Programsguide computers through actions specified by people called computer programmers.

...

Every program in Java consists of at least one class declaration that is defined by the programmer(also known as a programmer-defined class or a user-defined class).

...

Fortran (FORmula TRANslator) was developed by IBM Corporation in the mid-1950s for usein scientific and engineering applications that require complex mathematical computations.

...

If a program compiles, the compiler produces a .class file that contains the compiled program.

...

In 1981, IBM, the world's largest computer vendor, introduced the IBM Personal Computer,which quickly legitimized personal computing in business, industry and government.

...

In Phase 2, the programmer uses the command javac to compile a program.

...

In Phase 3, loading, the class loader takes the .class files containing the program's bytecodesand transfers them to primary memory.

...

In Phase 4, as the classes are loaded, the bytecode verifier examines their bytecodes to ensure thatthey are valid and do not violate Java's security restrictions.

...

In Phase 5, the JVM executes the program's bytecodes.Section 1.16 Software Engineering Case Study: Introduction to Object Technologyand the UML (Required)

...

In distributed computing, instead of computing being performed only at a central computer, itis distributed over networks to the sites where the organization's work is performed.

...

Integrated development environments (IDEs) provide tools that support software development,including editors for writing and editing programs and debuggers for locating logic errors.

...

Interpreter programs execute high-level language programs directly.Section 1.8 History of C and C++

...

Java Micro Edition (Java ME) is geared toward developing applications for small, memory-constraineddevices, such as cell phones,rs and PDAs.Section 1.2 What Is a Computer?

...

Java evolved from C++, which evolved from C, which evolved from BCPL and B.

...

Java has become widely used for writing software for computer networking and for distributedclient/server applications.Section 1.6 The Internet and the World Wide Web

...

Java is case sensitive—that is, uppercase and lowercase letters are distinct.

...

Java is the most widely used high-level programming language.

...

Java programmers concentrate on creating their own user-defined types called classes. Each classcontains data and methods that manipulate that data and provide services to clients.

...

Java programs consist of pieces called classes. Classes include pieces called methods that performtasks and return information when the tasks are completed.Section 1.10 Java Class Libraries

...

Java programs normally go through five phases—edit, compile, load, verify and execute.

...

Javadoc comments are delimited by /** and */. Javadoc comments enable programmers to embedprogram documentation directly in their programs. The javadoc utility program generatesHTML documentation based on Javadoc comments.

...

Machine languages generally consist of strings of numbers (ultimately reduced to 1s and 0s) thatinstruct computers to perform their most elementary operations one at a time.

...

Method System.out.println displays its argument in the command window followed by a newlinecharacter to position the output cursor to the beginning of the next line.

...

Method main is the starting point of every Java application and must begin withpublic static void main( String args[] )otherwise, the JVM will not execute the application.

...

Method printf's first argument is a format string that may consist of fixed text and format specifiers.Fixed text is output by printf just as it would be output by print or println. Each formatspecifier is a placeholder for a value and specifies the type of data to output.

...

Methods are able to perform tasks and return information when they complete their tasks. Keywordvoid indicates that a method will perform a task but will not return any information.

...

Microsoft's .NET platform integrates the Internet and the web into computer applications.Section 1.13 Typical Java Development Environment

...

Microsoft's Visual Basic language simplifies the development of Windows applications.

...

Most Java programmers take advantage of the rich collections of existing classes in the Java classlibraries, which are also known as the Java APIs (Application Programming Interfaces).

...

Most operating systems use the command cd to change directories in the command window.

...

Multiprocessors have multiple CPUs and, hence, can perform many operations simultaneously.

...

Object-oriented design (OOD) models software components in terms of real-world objects.

...

Object-oriented programming (OOP) implements object-oriented designs.

...

Objects have the property of information hiding—objects of one class are normally not allowedto know how objects of other classes are implemented.

...

Packaging software as classes makes it possible for future software systems to reuse the classes.

...

Pascal was designed for teaching structured programming in academic environments and rapidlybecame the preferred programming language in most colleges.

...

Research in the 1960s resulted in structured programming—an approach to writing programsthat are clearer, and easier to test, debug and modify than those produced with earlier techniques.

...

Servers store data that may be used by client computers distributed throughout the network,hence the term client/server computing.

...

Statements instruct the computer to perform actions.

...

System.out, the standard output object, allows Java applications to display characters in the commandwindow.

...

System.out.print displays its argument and positions the output cursor immediately after thelast character displayed.

...

System.out.printf method (f means "formatted") displays formatted data.

...

The Ada programming language was developed under the sponsorship of the U.S. Departmentof Defense (DOD) to fill most of its needs. An Ada capability called multitasking allowsprogrammers to specify that activities are to occur in parallel. Java, through a technique calledmultithreading, also enables programmers to write programs with parallel activities.Section 1.12 BASIC, Visual Basic, Visual C++, C# and .NET

...

The C language was developed by Dennis Ritchie at Bell Laboratories. It initially became widelyknown as the development language of the UNIX operating system. 5932 Chapter 1 Introduction to Computers, the Internet and the Web

...

The Internet is accessible by more than a billion computers and computer-controlled devices.

...

The Java compiler translates Java source code into bytecodes that represent the tasks to be executed.Bytecodes are executed by the Java Virtual Machine (JVM). Terminology 33

...

The advantage of creating your own classes and methods is that you know how they work andcan examine the code. The disadvantage is the time-consuming and potentially complex effort.Section 1.11 Fortran, COBOL, Pascal and Ada

...

The arithmetic and logic unit (ALU) is responsible for performing calculations (such as addition,subtraction, multiplication and division) and making decisions.

...

The central processing unit (CPU) coordinates and supervises the operation of the other sections.The CPU tells the input unit when information should be read into the memory unit, tells theALU when information from the memory unit should be used in calculations and tells the outputunit when to send information from the memory unit to certain output devices.

...

The input unit obtains information from input devices and places this information at the disposalof the other units so that it can be processed.

...

The memory unit is the rapid-access, relatively low-capacity "warehouse" section of the computer.It retains information that has been entered through the input unit, so that it will be immediatelyavailable for processing when needed. It also retains processed information until it can beplaced on output devices by the output unit.

...

The output unit takes information that the computer has processed and places it on various outputdevices to make the information available for use outside the computer.

...

The process of analyzing and designing a system from an object-oriented point of view is calledobject-oriented analysis and design (OOAD). SummarySection 2.2 A First Program in Java: Printing a Line of Text

...

The secondary storage unit is the long-term, high-capacity "warehousing" section of the computer.Programs or data not actively being used by the other units normally are placed on secondarystorage devices until they are again needed.Section 1.4 Early Operating Systems

...

Virtually every computer may be envisioned as divided into six logical units or sections.

...

When a method requires multiple arguments, the arguments are separated with commas (,)—this is known as a comma-separated list.

...

With the introduction of the World Wide Web the Internet has exploded into one of the world'spremier communication mechanisms.Section 1.7 Machine Languages, Assembly Languages and High-Level Languages

...

With timesharing, the computer runs a small portion of one user's job, then moves on to servicethe next user, perhaps providing service to each user several times per second.Section 1.5 Personal, Distributed and Client/Server Computing

...

You compile a program with the command javac. If the program contains no syntax errors, aclass file containing the Java bytecodes that represent the application is created. These bytecodesare interpreted by the JVM when we execute the program.Section 2.3 Modifying Our First Java Program

...


Set pelajaran terkait

Simulation Lab 4.1: Module 04 Repair a Duplicate IP Address (Networking CSNT 231)

View Set

AP Biology : Biotechnology Review Questions

View Set

Chapter 40: Care of Patients with Hematologic Problems

View Set

Community Total Questions from Both

View Set

Ch 16 - Fluid, Electrolyte & Acid-Base Imbalances

View Set

Chapter 3 - Types of Policies and Riders

View Set