更新时间:2021-07-02 15:23:14
coverpage
Title Page
Copyright
Java Programming for Beginners
Credits
About the Author
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Getting Started with Java
What is Java?
Features of Java
Java applications
Setting up your development environment
Installing JDK
Installing the NetBeans IDE
Writing our first Java program
Creating a new project
Creating a Java class
Writing the code
Java comments
The main() function
Printing a string
Java syntax
Executing our program
How to interpret errors detected by NetBeans?
The code completion feature
Summary
Understanding Typed Variables
Integer variables
The solution of variables
Memory allocation for integer variables
Floating point variables
Behavior difference between integer and float data types
Type casting
The double data type
The Math class library
Using the pow() function
Importing class libraries
Char variables
Strings
The concatenation operator
The toUpperCase() function
The replace() function
Escape sequences
Branching
Understanding if statements
Conditional statements
Using if statements
Using else statements
Complex conditionals
The contains function
Complex conditional statements
The boolean variable
Switch case and break
Program using switch case and break
While and do...while loops
While loops
The do...while loops
For loops
Data Structures
Working with arrays
Declaring and initializing an array
Assigning values to an array
Array example in NetBeans
Creating an array
Creating a for loop
Printing the alphabet
Default initialization of arrays in Java
Multidimensional arrays
A multidimensional array example in NetBeans
Creating a multidimensional array
Using nested loops for multidimensional arrays
Assigning different colors to our chessboard
Printing the chessboard
ArrayLists
An ArrayList example in NetBeans
Creating an ArrayList
Getting user input
Printing the ArrayList of user input
Giving control to the user
Analyzing ArrayIndexOutOfBoundsException
Maps
Creating a Map
Assigning values to our Map
Fetching information from our Map