Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Barry Burd
Java For Dummies, 6th Edition
Introduction
Introduction
How to Use This Book
Conventions Used in This Book
What You Don’t Have to Read
Foolish Assumptions
How This Book Is Organized
Part I: Getting Started with Java
Part II: Writing Your Own Java Program
Part III: Working with the Big Picture: Object-Oriented Programming
Part IV: Savvy Java Techniques
Part V: The Part of Tens
Icons Used in This Book
Beyond the Book
Where to Go from Here
Part I: Getting Started with Java
Chapter 1: All about Java
What You Can Do with Java
Why You Should Use Java
Getting Perspective: Where Java Fits In
Object-Oriented Programming (OOP)
Object-oriented languages
Objects and their classes
What’s so good about an object-oriented language?
Refining your understanding of classes and objects
What’s Next?
Chapter 2: All about Software
Quick-Start Instructions
What You Install on Your Computer
What is a compiler?
What is a Java Virtual Machine?
Developing software
What is an Integrated Development Environment?
Chapter 3: Using the Basic Building Blocks
Speaking the Java Language
The grammar and the common names
The words in a Java program
Checking Out Java Code for the First Time
Understanding a Simple Java Program
The Java class
The Java method
The main method in a program
How you finally tell the computer to do something
Curly braces
And Now, a Few Comments
Adding comments to your code
What’s Barry’s excuse?
Using comments to experiment with your code
Part II: Writing Your Own Java Programs
Chapter 4: Making the Most of Variables and Their Values
Varying a Variable
Assignment Statements
Understanding the Types of Values That Variables May Have
Displaying Text
Numbers without Decimal Points
Combining Declarations and Initializing Variables
The Atoms: Java’s Primitive Types
The char type
The boolean type
The Molecules and Compounds: Reference Types
An Import Declaration
Creating New Values by Applying Operators
Initialize once, assign often
The increment and decrement operators
Assignment operators
Chapter 5: Controlling Program Flow with Decision-Making Statements
Making Decisions (Java if Statements)
Guess the number
She controlled keystrokes from the keyboard
Creating randomness
The if statement
The double equal sign
Brace yourself
Indenting if statements in your code
Elseless in Ifrica
Forming Conditions with Comparisons and Logical Operators
Comparing numbers; comparing characters
Comparing objects
Importing everything in one fell swoop
Java’s logical operators
Vive les nuls!
(Conditions in parentheses)
Building a Nest
Choosing among Many Alternatives (Java switch Statements)
Your basic switch statement
To break or not to break
The new and improved switch
Chapter 6: Controlling Program Flow with Loops
Repeating Instructions Over and Over Again (Java while Statements)
Repeating a Certain Number of Times (Java for Statements)
The anatomy of a for statement
The world premiere of “Al’s All Wet”
Repeating Until You Get What You Want (Java do Statements)
Reading a single character
File handling in Java
Variable declarations and blocks
Part III: Working with the Big Picture: Object-Oriented Programming
Chapter 7: Thinking in Terms of Classes and Objects
Defining a Class (What It Means to Be an Account)
Declaring variables and creating objects
Initializing a variable
Using an object’s fields
One program; several classes
Public classes
Defining a Method within a Class (Displaying an Account)
An account that displays itself
The display method’s header
Sending Values to and from Methods (Calculating Interest)
Passing a value to a method
Returning a value from the getInterest method
Making Numbers Look Good
Hiding Details with Accessor Methods
Good programming
Public lives and private dreams: Making a field inaccessible
Enforcing rules with accessor methods
Chapter 8: Saving Time and Money: Reusing Existing Code
Defining a Class (What It Means to Be an Employee)
The last word on employees
Putting your class to good use
Cutting a check
Working with Disk Files (A Brief Detour)
Storing data in a file
Copying and pasting code
Reading from a file
Who moved my file?
Adding directory names to your filenames
Reading a line at a time
Closing the connection to a disk file
Defining Subclasses (What It Means to Be a Full-Time or Part-Time Employee)
Creating a subclass
Creating subclasses is habit-forming
Using Subclasses
Overriding Existing Methods (Changing the Payments for Some Employees)
A Java annotation
Using methods from classes and subclasses
Chapter 9: Constructing New Objects
Defining Constructors (What It Means to Be a Temperature)
What is a temperature?
What is a temperature scale? (Java's enum type)
Okay, so then what is a temperature?
What you can do with a temperature
Calling new Temperature(32.0): A case study
Some things never change
More Subclasses (Doing Something about the Weather)
Building better temperatures
Constructors for subclasses
Using all this stuff
The default constructor
A Constructor That Does More
Classes and methods from the Java API
The SuppressWarnings annotation
Part IV: Savvy Java Techniques
Chapter 10: Putting Variables and Methods Where They Belong
Defining a Class (What It Means to Be a Baseball Player)
Another way to beautify your numbers
Using the Player class
Nine, count ’em, nine
Don’t get all GUI on me
Tossing an exception from method to method
Making Static (Finding the Team Average)
Why is there so much static?
Meet the static initializer
Displaying the overall team average
Static is old hat
Could cause static; handle with care
Experiments with Variables
Putting a variable in its place
Telling a variable where to go
Passing Parameters
Pass by value
Returning a result
Pass by reference
Returning an object from a method
Epilogue
Chapter 11: Using Arrays to Juggle Values
Getting Your Ducks All in a Row
Creating an array in two easy steps
Storing values
Tab stops and other special things
Using an array initializer
Stepping through an array with the enhanced for loop
Searching
Writing to a file
When to close a file
Arrays of Objects
Using the Room class
Yet another way to beautify your numbers
The conditional operator
Command Line Arguments
Using command line arguments in a Java program
Checking for the right number of command line arguments
Chapter 12: Using Collections and Streams (When Arrays Aren't Good Enough)
Understanding the Limitations of Arrays
Collection Classes to the Rescue
Using an ArrayList
Using generics
Testing for the presence of more data
Using an iterator
Java's many collection classes
New in Java 8: Functional Programming
Solving a problem the old-fashioned way
Streams
Lambda expressions
A taxonomy of lambda expressions
Using streams and lambda expressions
Why bother?
Method references
Chapter 13: Looking Good When Things Take Unexpected Turns
Handling Exceptions
The parameter in a catch clause
Exception types
Who’s going to catch the exception?
The multi-catch clause
Throwing caution to the wind
Doing useful things
Our friends, the good exceptions
Handle an Exception or Pass the Buck
Finishing the Job with a finally Clause
A try Statement with Resources
Chapter 14: Sharing Names among the Parts of a Java Program
Access Modifiers
Classes, Access, and Multipart Programs
Members versus classes
Access modifiers for members
Putting a drawing on a frame
Directory structure
Making a frame
Sneaking Away from the Original Code
Default access
Crawling back into the package
Protected Access
Putting non-subclasses in the same package
Access Modifiers for Java Classes
Public classes
Nonpublic classes
Chapter 15: Responding to Keystrokes and Mouse Clicks
Go On . . . Click That Button
Events and event handling
The Java interface
Threads of execution
The keyword this
Inside the actionPerformed method
The serialVersionUID
Responding to Things Other Than Button Clicks
Creating Inner Classes
Chapter 16: Writing Java Applets
Applets 101
Waiting to be called
A public class
The Java API (again)
Making Things Move
The methods in an applet
What to put into all these methods
Responding to Events in an Applet
Chapter 17: Using Java Database Connectivity
JDBC and Java DB
Creating Data
Using SQL commands
Connecting and disconnecting
Retrieving Data
Part V: The Part of Tens
Chapter 18: Ten Ways to Avoid Mistakes
Putting Capital Letters Where They Belong
Breaking Out of a switch Statement
Comparing Values with a Double Equal Sign
Adding Components to a GUI
Adding Listeners to Handle Events
Defining the Required Constructors
Fixing Non-Static References
Staying within Bounds in an Array
Anticipating Null Pointers
Helping Java Find Its Files
Chapter 19: Ten Websites for Java
This Book’s Website
The Horse’s Mouth
Finding News, Reviews, and Sample Code
Looking for Java Jobs
Everyone’s Favorite Sites
About the Author
Cheat Sheet
More Dummies Products
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
01_9781118407806-ffirs.xhtml
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset