Java: A Beginner's Guide, Sixth Edition
Format: PDF / Kindle (mobi) / ePub
Essential Java Programming Skills--Made Easy!
Fully updated for Java Platform, Standard Edition 8 (Java SE 8), Java: A Beginner's Guide, Sixth Edition gets you started programming in Java right away. Bestselling programming author Herb Schildt begins with the basics, such as how to create, compile, and run a Java program. He then moves on to the keywords, syntax, and constructs that form the core of the Java language. This Oracle Press resource also covers some of Java's more advanced features, including multithreaded programming, generics, and Swing. Of course, new Java SE 8 features such as lambda expressions and default interface methods are described. An introduction to JavaFX, Java's newest GUI, concludes this step-by-step tutorial.
Designed for Easy Learning:
- Key Skills & Concepts -- Chapter-opening lists of specific skills covered in the chapter
- Ask the Expert -- Q&A sections filled with bonus information and helpful tips
- Try This -- Hands-on exercises that show you how to apply your skills
- Self Tests -- End-of-chapter quizzes to reinforce your skills
- Annotated Syntax -- Example code with commentary that describes the programming techniques being illustrated
The book's code examples are available FREE for download.
process of manually boxing and unboxing values. Type Wrappers As you know, Java uses primitive types, such as int or double, to hold the basic data types supported by the language. Primitive types, rather than objects, are used for these quantities for the sake of performance. Using objects for these basic types would add an unacceptable overhead to even the simplest of calculations. Thus, the primitive types are not part of the object hierarchy, and they do not inherit Object. Despite the
Bounded Wildcards Wildcard arguments can be bounded in much the same way that a type parameter can be bounded. A bounded wildcard is especially important when you are creating a method that is designed to operate only on objects that are subclasses of a specific superclass. To understand why, let’s work through a simple example. Consider the following set of classes: Here, class A is extended by classes B and C, but not by D. Next, consider the following very simple generic class: Gen
see, they have some special properties that make them quite interesting. Let’s begin by reviewing precisely what the increment and decrement operators do. The increment operator adds 1 to its operand, and the decrement operator subtracts 1. Therefore, is the same as and is the same as Both the increment and decrement operators can either precede (prefix) or follow (postfix) the operand. For example, can be written as or as In the foregoing example, there is no difference whether the
perfectly acceptable to use a subclass as a superclass of another. For example, given three classes called A, B, and C, C can be a subclass of B, which is a subclass of A. When this type of situation occurs, each subclass inherits all of the traits found in all of its superclasses. In this case, C inherits all aspects of B and A. To see how a multilevel hierarchy can be useful, consider the following program. In it, the subclass Triangle is used as a superclass to create the subclass
components of the language work in conjunction with each other. This interrelatedness is especially pronounced in Java. In fact, it is difficult to discuss one aspect of Java without involving others. To help overcome this problem, this chapter provides a brief overview of several Java features, including the general form of a Java program, some basic control structures, and operators. It does not go into too many details but, rather, concentrates on the general concepts common to any Java