Java: The Complete Reference, Ninth Edition

Java: The Complete Reference, Ninth Edition

Herbert Schildt

Language: English

Pages: 1312

ISBN: 0071808558

Format: PDF / Kindle (mobi) / ePub

The Definitive Java Programming Guide

Fully updated for Java SE 8, Java: The Complete Reference, Ninth Edition explains how to develop, compile, debug, and run Java programs. Bestselling programming author Herb Schildt covers the entire Java language, including its syntax, keywords, and fundamental programming principles, as well as significant portions of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. New Java SE 8 features such as lambda expressions, the stream library, and the default interface method are discussed in detail. This Oracle Press resource also offers a solid introduction to JavaFX.

Coverage includes:

  • Data types, variables, arrays, and operators
  • Control statements
  • Classes, objects, and methods
  • Method overloading and overriding
  • Inheritance
  • Interfaces and packages
  • Exception handling
  • Multithreaded programming
  • Enumerations, autoboxing, and annotations
  • The I/O classes
  • Generics
  • Lambda expressions
  • String handling
  • The Collections Framework
  • Networking
  • Event handling
  • AWT and Swing
  • The Concurrent API
  • The Stream API
  • Regular expressions
  • JavaFX
  • JavaBeans
  • Applets and servlets
  • Much, much more















where specifies the index of the character being obtained. For setCharAt( ), where specifies the index of the character being set, and ch specifies the new value of that character. For both methods, where must be nonnegative and must not specify a location beyond the end of the string. The following example demonstrates charAt( ) and setCharAt( ): // Demonstrate charAt() and setCharAt(). class setCharAtDemo { public static void main(String args[]) { StringBuffer sb = new StringBuffer("Hello");

that depends on the public interface of your classes. Polymorphism allows you to create clean, sensible, readable, and resilient code. Of the two real-world examples, the automobile more completely illustrates the power of object-oriented design. Dogs are fun to think about from an inheritance standpoint, but cars are more like programs. All drivers rely on inheritance to drive different types (subclasses) of vehicles. Whether the vehicle is a school bus, a Mercedes sedan, a Porsche, or the

for the benefit of those programmers working on pre-JDK 7 code or using pre-JDK 7 compilers. New code should take advantage of the NIO features added by JDK 7. Read a File, Pre-JDK 7 This section reworks the two channel-based file input examples shown earlier so they use only pre-JDK 7 features. The first example reads a file by manually allocating a buffer and then performing an explicit read operation. The second example uses a mapped file, which automates the process. When using a

position. The scroll bar will then reflect this value. In the background space on either side of the thumb, the user can click to cause the thumb to jump in that direction by some increment larger than 1. Typically, this action translates into some form of page up and page down. Scroll bars are encapsulated by the Scrollbar class. Figure 25-5 Sample output from the ListDemo applet Scrollbar defines the following constructors: Scrollbar( ) throws HeadlessException Scrollbar(int style) throws

components, a container can also hold other containers. This enables Swing to define what is called a containment hierarchy, at the top of which must be a top-level container. Let’s look a bit more closely at components and containers. Components In general, Swing components are derived from the JComponent class. (The only exceptions to this are the four top-level containers, described in the next section.) JComponent provides the functionality that is common to all components. For

Download sample