Day OneJava Basics
Introduction
- Audience
- Introductions
- Course Objectives
- Schedule
- Lesson Format
- Course Environment
- How Do You Learn More After the Course?
- Additional Resources
- Summary
What Is a Java Program?
- Objectives
- Purpose of a Computer Program
- Translating High-Level Code to Machine Code
- Linked to Platform-Specific Libraries
- Platform-Dependent Programs
- Key Features of the Java Language
- Java Is Platform-Independent
- Java Programs Run In a Java Virtual Machine
- Procedural Programming Languages
- Java Is an Object-Oriented Language
- Verifying the Java Development Environment
- Examining the Installed JDK: The Tools
- Compiling and Running a Java Program
- Compiling a Program
- Executing (Testing) a Program
- Output for a Java Program
- Launch Single-File Source-Code Programs
The Java Main Class
- Objectives
- Java Classes
- Program Structure
- Java Packages
- Java IDEs
- The NetBeans IDE
- Creating a Java Project
- Creating a Java Class
- Exercise 3-1:Creating a New Project and Java Class
- Opening an Existing Java Project
- Creating a New Java Package
- The main Method
- A main Class Example
- Output to the Console
- Avoiding Syntax Errors
- Compiling and Running a Program by Using NetBeans
- Exercise 3-2: Creating a main Method
Variables
- Objectives
- Variables
- Variable Types
- Naming a Variable
- Java SE 9: The Underscore Character Is Not a Legal Name
- Uses of Variables
- Examples: Variable Declaration and Initialization
- String Concatenation
- int and double Values
- Initializing and Assigning Numeric Values
- Standard Mathematical Operators
- Increment and Decrement Operators (++ and --)
- Operator Precedence
- Using Parentheses
Day Two
Conditionals, Arrays, Loops
- Objectives
- Making Decisions
- The if/else Statement
- Boolean Expressions
- Relational Operators
- What If There Are Multiple Items in the Shopping Cart?
- Introduction to Arrays
- Array Examples
- Array Indices and Length
- Declaring and Initializing an Array
- Accessing Array Elements
- Loops
- Processing a String Array
- Using break with Loops
Objects and Classes
- Object-Oriented Programming
- Characteristics of Objects
- Classes and Instances
- The Customer Properties and Behaviors
- The Components of a Class
- Modeling Properties and Behaviors
- Customer Instances
- Object Instances and Instantiation Syntax
- The Dot (.) Operator
- Objects with Another Object as a Property
- Accessing Objects by Using a Reference
- Working with Object References
- References to Different Objects
- References and Objects in Memory
- Assigning a Reference to Another Reference
- Two References, One Object
- Arrays Are Objects
- Declaring, Instantiating, and Initializing Arrays
- Storing Arrays in Memory
- Storing Arrays of Object References in Memory
- Creating a Soccer Application
Strings, Formatting Data, Data Types
- String Class
- Concatenating Strings
- String Method Calls with Primitive Return Values
- String Method Calls with Object Return Values
- Java API Documentation
- indexOf Method Example
- Use indexOf and substring Methods
- StringBuilder Class
- StringBuilder Advantages over String for Concatenation (or Appending)
- StringBuilder: Declare and Instantiate
- StringBuilder Append
- Primitive Data Types
- Some New Integral Primitive Types
- Floating Point Primitive Types
- Textual Primitive Type
- Java Language Trivia: Unicode
- Constants
- Modulus Operator
- Combining Operators to Make Assignments
- More on Increment and Decrement Operators
- Increment and Decrement Operators (++ and ––)
- Promotion
- Caution with Promotion
- Type Casting
- Caution with Type Casting
- Using Promotion and Casting
- Compiler Assumptions for Integral and Floating Point Data Types
- Automatic Promotion
- Using a long
- Using Floating Points
- Floating Point Data Types and Assignment
Creating and Using Methods
- Basic Form of a Method
- Calling a Method from a Different Class
- Caller and Worker Methods
- A Constructor Method
- Writing and Calling a Constructor
- Calling a Method in the Same Class
- Method Arguments and Parameters
- Method Parameter Examples
- Method Return Types
- Method Return Types Examples
- Method Return Animation
- Passing Arguments and Returning Values
- More Examples
- Code Without Methods
- Better Code with Methods
- Even Better Code with Methods
- Variable Scope
- Advantages of Using Methods
- Declare a setColor Method
- Static Methods and Variables
- Example: Setting the Size for a New Item
- Creating and Accessing Static Members
- When to Use Static Methods or Fields
- Some Rules About Static Fields and Methods
- Static Fields and Methods Versus Instance Fields and Methods
- Static Methods and Variables in the Java API
- Examining Static Variables in the JDK Libraries
- Using Static Variables and Methods: System.out.println
- More Static Fields and Methods in the Java API
- Converting Data Values
Day Three
Encapsulation, Constructors
- What Is Access Control?
- Access Modifiers
- Access from Another Class
- Passing an Object Reference
- What If There Is a New Object?
- A Shopping Cart Code Example
- Passing by Value
- Reassigning the Reference
- Passing by Value
- Method Overloading
- Using Method Overloading
- Method Overloading and the Java API
- Overloading a setItemFields Method
- Another Example Using Access Control on Methods
- Encapsulation
- Get and Set Methods
- Why Use Setter and Getter Methods?
- Setter Method with Checking
- Using Setter and Getter Methods
- Encapsulate a Class
- Initializing a Shirt Object
- Constructors
- Shirt Constructor with Arguments
- Default Constructor and Constructor with Args
- Overloading Constructors
More on Conditionals
- Objectives
- Review: Relational Operators
- Testing Equality Between String variables
- Common Conditional Operators
- Ternary Conditional Operator
- Using the Ternary Operator
- Exercise 10-1: Using the Ternary Operator
- Handling Complex Conditions with a Chained if Construct
- Determining the Number of Days in a Month
- Chaining if/else Constructs
- Exercise 10-2: Chaining if Statements
- Handling Complex Conditions with a switch Statement
- Coding Complex Conditions: switch
- switch Statement Syntax
- When to Use switch Constructs
Arrays, Loops, and Dates
- Displaying a Date
- Class Names and the Import Statement
- Working with Dates
- Working with Different Calendars
- Some Methods of LocalDate
- Working with an IDE Debugger
- Debugger Basics
- Setting Breakpoints
- The Debug Toolbar
- Viewing Variables
- Formatting Dates
- Using the args Array in the main Method
- Converting String Arguments to Other Types
- Pass Arguments to the args Array in NetBeans
- Describing Two-Dimensional Arrays
- Declaring a Two-Dimensional Array
- Instantiating a Two-Dimensional Array
- Initializing a Two-Dimensional Array
- Some New Types of Loops
- Repeating Behavior
- Coding a while Loop
- A while Loop Example
- while Loop with Counter
- Coding a Standard for Loop
- Standard for Loop Compared to a while loop
- Standard for Loop Compared to an Enhanced for Loop
- do/while Loop to Find the Factorial Value of a Number
- Coding a do/while Loop
- Comparing Loop Constructs
- The continue Keyword
- Nesting Loops
- Nested for Loop
- Nested while Loop
- Processing a Two-Dimensional Array
- Output from Previous Example
- ArrayList Class
- Benefits of the ArrayList Class
- Importing and Declaring an ArrayList
- Working with an ArrayList
Day Four
Inheritance, Polymorphism
- Duke’s Choice Classes: Common Behaviors
- Code Duplication
- Inheritance
- Inheritance Terminology
- Implementing Inheritance
- More Inheritance Facts
- Clothing Class: Part 1
- Shirt Class: Part 1
- Constructor Calls with Inheritance
- Inheritance and Overloaded Constructors
- Creating a Subclass
- More on Access Control
- Overriding Methods
- Review: Duke’s Choice Class Hierarchy
- Clothing Class
- Shirt Class
- Overriding a Method: What Happens at Run Time?
- Overriding a Method in the Superclass
- Polymorphism
- Superclass and Subclass Relationships
- Using the Superclass as a Reference
- Polymorphism Applied
- Accessing Methods Using a Superclass Reference
- Casting the Reference Type
- instanceof Operator
- Using the instanceof Operator
- Abstract Classes
- Extending Abstract Classes
Interfaces
- The Object Class
- Calling the toString Method
- Overriding toString in Your Classes
- The Multiple Inheritance Dilemma
- The Java Interface
- No Multiple Inheritance of State
- Multiple Hierarchies with Overlapping Requirements
- Using Interfaces in Your Application
- Implementing the Returnable Interface
- Access to Object Methods from Interface
- Casting an Interface Reference
- Benefits
- Where Can it be Used?
- Why is The Scope So Narrow?
- Local Variable Type Inference
- The Collections Framework
- ArrayList Example
- List Interface
- Example: Arrays.asList
- Converting an Array to an ArrayList
- Modifying a List of Names
- Using a Lambda Expression with replaceAll
- Lambda Expressions
- The Enhanced APIs That Use Lambda
- Lambda Types
- The UnaryOperator Lambda Type
- The Predicate Lambda Type
Handling Exceptions
- What Are Exceptions?
- Examples of Exceptions
- Code Example
- Another Example
- Types of Throwable classes
- Error Example: OutOfMemoryError
- Normal Program Execution: The Call Stack
- How Exceptions Are Thrown
- Working with Exceptions in NetBeans
- The try/catch Block
- Program Flow When an Exception Is Caught
- When an Exception Is Thrown
- Throwing Throwable Objects
- Uncaught Exception
- Exception Printed to Console
- Summary of Exception Types
- Catching an Exception
- Exceptions in the Java API Documentation
- Calling a Method That Throws an Exception
- Working with a Checked Exception
- Bad Practices
- Somewhat Better Practice
- Multiple Exceptions
- Catching IOException
- Catching IllegalArgumentException
- Catching Remaining Exceptions
- Packages
- Packages Directory Structure
- Packages in NetBeans
- Packages in Source Code
- SoccerEnhanced.jar
- Set Main Class of Project
- Creating the JAR File with NetBeans
- Client/Server Two-Tier Architecture
- Client Server Three-Tier Architecture
- Client/Server Three-Tier Architecture
- Different Outputs
- The Soccer Application
- IDisplayDataItem Interface
- Running the JAR File from the Command Line
- Text Presentation of the League
- Web Presentation of the League
- Enhancing the Application
- Adding a New GameEvent Kickoff
- Game Record Including Kickoff
Day Five
Continuing with Deploying and Maintaining the Soccer ApplicationSubscribe to our Newsletter for latest news.
If the pdf download does not work, try a different browser


© 2004+
Back to top