Front cover image for Java : a beginner's guide

Java : a beginner's guide

Fully updated for Java Platform, Standard Edition 8 (Java SE 8), this book begins with the basics, such as how to create, compile, and run a Java program and then moves on to the keywords, syntax, and constructs that form the core of the Java language. Also covers more advanced features, including multithreaded programming, generics, and Swing; new Java SE 8 features such as lambda expressions and default interface methods; and JavaFX, Java's newest GUI. The book includes Q & A sections, hands-on exercises, end-of-chapter quizzes, and example code with commentary that describes the programming techniques being illustrated
eBook, English, ©2014
McGraw-Hill Education, New York, ©2014
1 online resource (1 volume) : illustrations
9780071809269, 0071809260
880900674
Cover
About the Author
About the Technical Reviewer
Title Page
Copyright Page
Contents at a Glance
Contents
Introduction
Chapter 1: Java Fundamentals
The Origins of Java
How Java Relates to C and C++
How Java Relates to C#
Java's Contribution to the Internet
Java Applets
Security
Portability
Java's Magic: The Bytecode
The Java Buzzwords
Object-Oriented Programming
Encapsulation
Polymorphism
Inheritance
Obtaining the Java Development Kit
A First Simple Program
Entering the Program
Compiling the Program The First Sample Program Line by Line
Handling Syntax Errors
A Second Simple Program
Another Data Type
Try This 1-1: Converting Gallons to Liters
Two Control Statements
The if Statement
The for Loop
Create Blocks of Code
Semicolons and Positioning
Indentation Practices
Try This 1-2: Improving the Gallons-to-Liters Converter
The Java Keywords
Identifiers in Java
The Java Class Libraries
Chapter 1: Self Test
Chapter 2: Introducing Data Types and Operators
Why Data Types Are Important
Java's Primitive Types
Integers
Floating-Point Types Characters
The Boolean Type
Try This 2-1: How Far Away Is the Lightning?
Literals
Hexadecimal, Octal, and Binary Literals
Character Escape Sequences
String Literals
A Closer Look at Variables
Initializing a Variable
Dynamic Initialization
The Scope and Lifetime of Variables
Operators
Arithmetic Operators
Increment and Decrement
Relational and Logical Operators
Short-Circuit Logical Operators
The Assignment Operator
Shorthand Assignments
Type Conversion in Assignments
Casting Incompatible Types
Operator Precedence Try This 2-2: Display a Truth Table for the Logical Operators
Expressions
Type Conversion in Expressions
Spacing and Parentheses
Chapter 2: Self Test
Chapter 3: Program Control Statements
Input Characters from the Keyboard
The if Statement
Nested ifs
The if-else-if Ladder
The switch Statement
Nested switch Statements
Try This 3-1: Start Building a Java Help System
The for Loop
Some Variations on the for Loop
Missing Pieces
The Infinite Loop
Loops with No Body
Declaring Loop Control Variables Inside the for Loop
The Enhanced for Loop The while Loop
The do-while Loop
Try This 3-2: Improve the Java Help System
Use break to Exit a Loop
Use break as a Form of goto
Use continue
Try This 3-3: Finish the Java Help System
Nested Loops
Chapter 3: Self Test
Chapter 4: Introducing Classes, Objects, and Methods
Class Fundamentals
The General Form of a Class
Defining a Class
How Objects Are Created
Reference Variables and Assignment
Methods
Adding a Method to the Vehicle Class
Returning from a Method
Returning a Value
Using Parameters
Adding a Parameterized Method to Vehicle
"Fully updated for Java SE 8 (JDK 8)"--Cover
Includes index