About the Book
Java 8 Black Book is a solid introductory reference that has been written from the experts’ point of view and so includes hundreds of examples covering every feature of the subject. The book takes you in the direction of mastering the entire spectrum of Java 8—from generics to security enhancements, from new applet deployment enhancements to networking, from multiple threads to JavaBeans, from JDBC to file handling and much more. Designed to contain more on Java 8 than any other book on the topic, every aspect of this book is worth its price About the Author
DT Editorial Services has seized the market of computer books, bringing excellent content in software development to the fore. The team is committed to excellence—excellence in quality of content, excellence in the dedication of its authors and editors, excellence in the attention to detail, and excellence in understanding the needs of its readers.
Table of Contents:
Chapter 1: Essential Java
In Depth
All about Java
Java Appears
All about Bytecodes
Features of Java
Java Environment
Java Development Kit
Java Platforms
Java Virtual Machine
Java API
Java Programs
What are Application Servers (Tomcat, JRun, WebSphere, WebLogic, etc.)
Program Design
Performance
Maintainability
Extensibility
Availability
New Features of Java SE 8
Immediate Solutions
Getting and Installing Java
What about CLASSPATH?
Subfolders Created by JDK
Creating Source Files
Knowing Java’s Reserved Words
Creating an Application
Line 1—public class App
Line 2—public static void main(String[] args)
Line 3—System.out.println(“Hello from Java!”);
Compiling Code
Compiling Code: Using Command-Line Options
Cross-Compilation Options
Compiling Code: Checking for Deprecated Methods
Running Code
Running Code: Using Command-Line Options
Commenting Your Code
Import Java Packages and Classes
Finding Java Classes with CLASSPATH
Summary
Chapter 2: Variables, Arrays, and Strings
In Depth
Variables
Data Typing
Arrays
Strings
Immediate Solutions
What Data Types are Available?
Creating Integer Literals
Creating Floating-Point Literals
Creating Boolean Literals
Creating Character Literals
Creating String Literals
Creating Binary Literals
Using Underscores in Numeric Literals
Declaring Integer Variables
Declaring Floating-Point Variables
Declaring Character Variables
Declaring Boolean Variables
Initializing Variables Dynamically
Conversion between Data Types
Automatic Conversions
Casting to New Data Types
Declaring One-Dimensional Arrays
Creating One-Dimensional Arrays
Initializing One-Dimensional Arrays
Declaring Multi-Dimensional Arrays
Creating Multi-Dimensional Arrays
Initializing Multi-Dimensional Arrays
Creating Irregular Multi-Dimensional Arrays
Getting an the Length of an Array
Understanding General Form of Static Import
Importing Static Members
The String Class
Creating Strings
Getting String Length
Concatenating Strings
Getting Characters and Substrings
Searching For and Replacing Strings
Changing Case in Strings
Checking for Empty String
Formatting Numbers in Strings
The StringBuffer Class
Creating StringBuffers
Getting and Setting StringBuffer Lengths and Capacities
Setting Characters in String Buffers
Appending and Inserting Using StringBuffers
Deleting Text in StringBuffers
Replacing Text in StringBuffer
Using the Wrapper Class
Autoboxing and Unboxing of Primitive Types
Learning the Fundamentals of Varargs Methods
Overloading Varargs Methods
Learning the Ambiguity in Varargs Methods
Using Non-Reifiable Formal Parameters
Summary
Chapter 3: Operators, Conditionals, and Loops
In Depth
Operators
Conditionals
Loops
Immediate Solutions
Operator Precedence
Incrementing and Decrementing (++ and --)
Unary NOT (~ And !)
Multiplication and Division (* and /)
Modulus (%)
Addition and Subtraction (+ and -)
Shift Operators (>>, >>>, and <<)
Relational Operators (>, >=, <, <=, ==, and !=)
Bitwise and Bitwise Logical AND, XOR, and OR (&, ^, and /)
Logical (&& and ||)
The if-then-else Operator (?:)
Assignment Operators (= and [operator]=)
Using the Math Class
Changes in the Math Class
Class StrictMath
Comparing Strings
The if Statement
The else Statement
Nested if Statement
The if-else Ladders
The switch Statement
Using Strings in switch Statement
The while Loop
The do-while Loop
The for Loop
The for-each Loop
Supporting for-each in Your Own Class
A (Poor) Solution
Significance of for-each
Nested Loops
Using the break Statement
Using the continue Statement
Summary
Chapter 4: Object-Oriented Programming
In Depth
Classes
Objects
Data Members
Methods
Inheritance
Exception Handling
Debugging
Immediate Solutions
Declaring and Defining Classes
Declaring and Creating Objects
Creating Instance Variables
Setting Variable Access
Creating Class Variables
Creating Methods
Setting Method Access
Passing Parameters to Methods
Command-Line Arguments Passed to main() method
Returning Values from Methods
Creating Class Methods
Creating Data Access Methods
Creating Constructors
Passing Parameters to Constructors
A Full Class Example
Understanding Variable Scope
Using Recursion
Garbage Collection and Memory Management
Avoiding Circular References
Garbage Collection and the finalize() Method
Overloading Methods
Overloading Constructors
Passing Objects to Methods
Passing Arrays to Methods
Using the this Keyword
Returning Objects from Methods
Returning Arrays from Methods
The ProcessBuilder and StringBuilder Classes
The ProcessBuilder Class
The StringBuilder Class
Catching an Exception
Nesting the try Statements
Using the finally Clause
Throwing Exceptions
Creating a Custom Exception
Catching Multiple Exception Types
Rethrowing Exceptions with Improved Type Checking
Debugging Java Programs
Summary
Chapter 5: Inheritance, Inner Classes, and Interfaces
In Depth
Why Inheritance?
Why Interfaces?
Why Inner Classes?
Lambda Expressions
Method References
Immediate Solutions
Creating a Subclass
Access Specifiers and Inheritance
Calling Superclass Constructors
Creating Multilevel Inheritance
Handling Multilevel Constructors
Overriding Methods
Accessing Overridden Members
Using Superclass Variables with Subclassed Objects
Dynamic Method Dispatch (Runtime Polymorphism)
Creating Abstract Classes
Stopping Overriding with final
Stopping Inheritance with final
Creating Constants with final
Is-a vs. Has-a Relationships
The Java Object Class
Using Interfaces for Multiple Inheritance
The Readable Interface
The Appendable Interface
The Iterable Interface
Creating Iterable Objects
Creating Inner Classes
Creating Anonymous Inner Classes
Using Lambda Expression
Default Methods
Summary
Chapter 6: AWT—Applets, Applications, and Event Handling
In Depth
The Abstract Windowing Toolkit
Applets
Applications
Handling Events
Immediate Solutions
Using the Abstract Window Toolkit
Creating Applets
Using the