java standard edition seobject oriented programming (oop) : learn what an "object oriented...

38
Java Standard Edition SE Full Course Outline

Upload: others

Post on 22-May-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Java Standard Edition SEFull Course Outline

Page 2: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Installing Eclipse

1. Installing the java SE Development kit 8

(JDK)

Page 3: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

The feature goals that the creators of Java had in mind when they were

designing the language. Learn about "platform independence" and other

features

2. The features of the java programming

language

Page 4: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Discover the "Java Runtime Environment (JRE)" and how it is used to

execute Java programs

Quiz – test your knowledge of concepts on java platform

Editions and versions

3. The java platform

Page 5: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Class project - Part 1 (Lab)

4. The java development kit (JDK)

Page 6: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

A "50,000 feet view" of a small Java program. Learn about classes,

methods, parameters/arguments, return types, and modifiers. We also

cover the "front door" of a Java application: the "main" method.

5. Class project - Part 1 (Lab)

Page 7: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Now that the program has been written, how do we run it? This lecture

covers the compilation and execution process of a Java program.

Java API Documentation(Javadocs)

6. Class project – part 2 (Lab) – Compilation

and Execution

Page 8: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

SPAN, RSPAN

Section Overview

Object Oriented Programming (OOP) : Learn what an "object oriented

program" is, and the benefits they deliver

Object vs. Primitives : Discussion on the different characteristics between

Java primitives (such as an int or boolean) and objects

Stack & Heap: One of the main keys to mastering Java is to understand

how objects and method variables are represented in memory. This lecture

defines two areas of memory: the stack and the heap

7. Introduction To Objects

Page 9: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Using Objects: Objects may contain state and/or behavior. This lectures

defines how to access and set these features of an object

Initializing Data Introduces the "constructor" as a means to initialize the

state of an object

Creating Object Types: This lecture formally defines the purpose of a

Class.

A walkthrough of creating a "Car" class with state and behavior.

Now that the "car" class has been created, we'll look at how we can use it.

In addition, the "return" feature is demonstrated.

Building Contructors: In a previous lecture, using a constructor to initialize

an object was demonstrated. Now you'll learn how to create your own

constructors.

Page 10: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Quiz - Test your knowledge on defining/invoking constructors and default

values.

Initialization Blocks: Constructors aren't the only way to initialize an object.

This lecture introduces another construct for this purpose: the initialization

block.

Default Constructor: If you don't create a custom constructor, the compiler

provides one for you. Learn about the benefits and possible consequences

of this feature.

Introduction to Objects Lab Instructions for the Objects lab.

Page 11: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Filtering Traffic Based on the Port Used

Analysing HTTP Requests

Intercepting HTTP Requests

Modifying HTTP Responses on The Fly

Intercepting & Replacing Downloads on The Network

8. Writing a File Interceptor

Page 12: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Static variables : Variables can be assigned to a class (rather than an

object). This lecture introduces the syntax of these variables and how they

are used

Quiz – Using static variables and Methods Test yourself to see how much

you've learned about static variables and methods!

Static initialization : An instance initialization block is executed every time a

new instance is created. A static initialization block is only executed once:

when the class is loaded. Learn the syntax and restrictions of this feature

“this” – part 1 The keyword "this" refers to the specific instance of a class

that is in focus. Here we show how the keyword can be applied to class.

9. Static, Scope and Garbage collection

Page 13: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

“this” – part 2 Now that we know how "this" is applied, let's look at one of

the main use cases of why it exists: disambiguation. In addition, we revisit

and expand upon the topic of the stack and heap.

“this” – part 3 The keyword "this" can also be used to chain constructors

together. Learn how to use this feature and the reasons why it exists.

Scope – Part 1 Scope defines the lifecycle and accessibility of state. Learn

how to recognize the scope of a variable in a class.

Scope - Part 2 More demonstrations on how to recognize the scope of a

variable.

Garbage Collection In other programming languages, memory must be

managed by the developer. Java, helps us out here with a feature called

"Garbage Collection."

Page 14: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Java Memory Leaks

Although Java helps us out with memory management, we can still,

unintentionally cause issues. This lecture demonstrates a situation that

could cause something similar to a memory leak (memory that is occupied

but unused).

Class challenge

Assignment

Page 15: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Packages : Learn how to organize your code and prevent name collisions

(two or more libraries that have a class with the same name), with

"packages.”

Packages and imports : Learn all the rules of packages and imports

Classpath : A classpath defines where classes can be found for compilation

and execution. Learn how to set these locations in this lecture.

JARs : Most applications and libraries are distributed in compressed files

called JARs. Learn how to create these files.

Lab – Packages

Assignment

10. Packages

Page 16: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Coding standards : learn the conventions that most Java developers use

when writing applications

Comments : Comments are blocks of text in code that are intended for

other developers. Anything that uses the comment syntax is excluded from

normal code execution.

Javadoc : In a previous lecture we talked about how to read Javadocs - in

this lecture you'll learn how to write your own!

Quiz – Identifiers and comments : Have you memorized all of the rules

about identifiers and comments? Let's find out!

Primitive data types

11. Java Conventions and Primitives

Page 17: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Primitive Conversion : Sometimes we need to assign one primitive value

type to a different variable type (such as when we pass an existing value

as an argument to a method). Learn those rules, including the concept of

"casting" in this lecture.

Quiz – Primitive : Test your knowledge on primitives and the rules of

casting!

Big Numbers : What happens when we need to use longer or more precise

number than those supported by primitives? Luckily we have BigInteger

and BigDecimal two classes that support big numbers.

Lap – Primitive

Assignment

Page 18: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Section Overview

Conditionals – if | Else if | Else

Conditionals allow us to write blocks of code that are executed if a certain

state is true or false

Conditionals – Switch : A switch is another syntax available when defining

conditionals.

Operators : Learn the different operators available to Java, and just as

important (especially for the exam) - the order of precedence.

Loops : Conditionals are one type of control structure. Another type allows

us to continuously execute a block of a code while a condition is true.

12. Java Syntax

Page 19: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Break, Continue and Labels : Loops allow us to manage their flow within

their own bodies. This lecture defines the keywords that allow us to

manipulate that flow.

Enumerations (enum) : An Enum (short for enumeration) allows us to

create strongly typed (a structure that is verified by the compiler) label.

Learn the syntax of an enum in this lecture.

Java Syntax Lab

Page 20: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

String Objects : A String is an object provided by the Java SE API, that

exhibits some unique characteristics. This lecture details the structure of

this object.

String operations and operators : Learn the most common methods and

operations available to Strings

Immutable strings :Once a String has been created it can never be

changed. This is known as "immutability." Here you'll learn why Strings

are immutable and how we handle this restriction in our programs.

13. Strings

Page 21: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Immutable strings :Once a String has been created it can never be

changed. This is known as "immutability." Here you'll learn why Strings

are immutable and how we handle this restriction in our programs.

Pass by Value: Primitive When a variable is passed as an argument into a

method, what is really being passed? This lecture details how primitive

arguments are handled in Java.

Passing By Value; Objects Continuing the examination of passing

arguments, with objects, including Strings.

Lab - Passing by value

Page 22: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

String Objects: A String is an object provided by the Java SE API, that

exhibits some unique characteristics. This lecture details the structure of

this object.

String operations and operators Learn the most common methods and

operations available to Strings

Immutable strings Once a String has been created it can never be

changed. This is known as "immutability." Here you'll learn why Strings

are immutable and how we handle this restriction in our programs.

Quiz – working with strings - Test your knowledge on Strings!

14. Encapsulation

Page 23: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Pass by Value: Primitive When a variable is passed as an argument into a

method, what is really being passed? This lecture details how primitive

arguments are handled in Java.

Passing By Value; Objects Continuing the examination of passing

arguments, with objects, including Strings.

Lab - Passing by value

Page 24: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

The next pillar of object oriented programming is "inheritance." This is a

feature that lets us build new objects from others they are related to.

More demonstrations of how inheritance is applied and the rules that

accompany this feature

Chaining constructors In a previous lecture, the concept of chaining

constructors with the keyword "this" was demonstrated. In this lecture, the

focus is on chaining constructors between super and subtypes.

Overloading Methods: All methods must have unique signatures. However,

as long as the parameter list is unique, multiple methods may have the

same name. This is called "overloading" a method.

15. Inheritance

Page 25: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Overriding Methods To change the behavior that is defined in a super

class, we "override" methods. This syntax and its restrictions are detailed

in this lecture.

Covariant Returns: When overriding a method, Java allows the return type

to be a subtype of the type declared in the overridden method. This feature

is known as a "covariant return.“

The three Faces of Final The keyword "final" may be applied to variables,

methods, and classes. This feature prevents further modification of these

constructs, once defined

Page 26: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Polymorphism Demo: Polymorphism (the ability to send the same general

message to related types, but have them process the message in a unique

manner), is a tough subject. To help mitigate the difficulty in learning this,

we start with a demo.

The first steps at understanding the syntax of polymorphism.

Then More examples and discussion on polymorphism.

16. Polymorphism

Page 27: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

See how polymorphism enables us to write flexible and dynamic

applications.

Object type casting Casting changes the reference to a more specific type

(allowing for additional state and behavior to be accessed).

The Object Class At the top of every object hierarchy is java.lang.Object.

Learn about overriding Object's toString, equals, and hashCode methods.

17. Benefits of Polymorphism

Page 28: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Abstract Classes Abstract classes are constructs that allow subtypes to

share common state and behavior definitions, all while enabling

polymorphism.

More examples of using abstract classes.

Interfaces Part 1: Interfaces define a role that a class can fulfill. Like

abstract classes, an interface enables objects to be treated

polymorphically.

Part 2: Examples of using interfaces for polymorphism and demonstrations

of new interface features that were added to Java SE 8

Part 3: A discussion about the benefits of using interfaces.

18. Abstract Classes and Interfaces

Page 29: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Marker and functional interfaces A marker interface has no methods, and a

functional interface has only one abstract method. The latter is used with

lambda expressions.

Lambda Expressions A lambda expression allows us to use a terse syntax

to define the implementation of a functional interface

Predicate A predicate is a general functional interface that is provided by

the Java SE API.

Static Imports Static Imports allow us to code static references from other

types, as if they were defined in our own class.

19. Lambda Expressions and Static imports

Page 30: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

LocalDate Java SE 8 includes a new java.time package. LocalDate is an

immutable class to represent a date (no timestamp).

DateTimeFormatter Dates and Times may be formatted in a custom

manner, through the use of the DateTimeFormatter.

Lab - Dates and Time Instructions for the Dates and Time Lab.

20. Dates and Time

Page 31: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

An array is a data structure that holds multiple primitives or objects that are

of the same polymorphic type

Polymorphism Revisited An example of how polymorphism may be applied

to an array.

Multi-Dimensional Arrays A multi-dimensional array holds one or more

arrays.

Common Arrays Mistakes Avoid these common beginner mistakes!

Sorting and Searching Arrays Helper methods to sort and search through

an array.

Varargs: Varargs allows methods to take zero or more objects (without

having to explicitly wrap them in an array).

21. Arrays

Page 32: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

DHCP client, IOS DHCP server, DHCP relay

When Arrays Are Not Enough Outlines the differences between arrays and

collections.

Collections The basic syntax of using a collection.

The collection interface The most general interface that can be used with

many collection classes (excluding maps).

Iterator An iterator provides a polymorphic way of looping through a

collection.

Lists A list is a collection that retains the order the objects were added to it

(unless it is sorted). In addition it permits duplicate objects.

22. Collections

Page 33: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Sets A set is a collection that organizes the data in a order for fast

searching (so it doesn't necessarily maintain the order that you put them

in). In addition, it does not allow duplicate (equal) objects.

Queues A queue is a FIFO collection (first in, first out). Items are added to

the tail and removed from the head.

Deques A deque is a "double ended queue," which allows FIFO (first in,

first out) and LIFO (last in, first out) access. Objects can be added and

removed from either the head or the tail.

Maps A map is a collection that is great for random access. Each item in a

map is associated with a unique object based key.

Page 34: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Limitations of collections Collections are unable to store primitives.

However, the Java SE API provides "wrapper" classes which enable

primitive values to be added to a collection.

Generics and Autoboxing Generics and autoboxing help simplify some of

the limitations outlined earlier in this section.

Diamond Operator Java SE 7 introduced the diamond operator <> to

simplify declaring parameter types.

Sorting and searching Like arrays, collections can be sorted and searched

through, with methods provided by the Collections class.

23. More with Collections

Page 35: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Comparable In order for a type to be sortable, it must provide information

on how it should be sorted (when compared to another object).

Implementing the Comparable interface is one option for providing this

information.

Comparator Another option for providing sorting information is to create a

Comparator object which takes two objects and returns their order.

Page 36: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Throwable A Throwable is an object that contains error or exception

information.

Catching Exceptions Once a Throwable is thrown, the JVM looks for code

to handle the exception. This process is known as "catching an exception.“

Finally, block Finally is an optional part of a try/catch block, which ensures

that code will be run in any circumstance (other than when a catastrophic

error occurs).

The exception Object Exception is a subtype of Throwable, with methods

for learning about what went wrong during the execution of a program.

24. Exception Handling

Page 37: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Unchecked Exceptions The compiler will enforce developers to write code

that handles certain types of exceptions. These are known as "checked"

exceptions. Others, which are not enforced, are known as "unchecked" or

"runtime" exceptions.

Creating Exceptions Learn how to create and throw custom exceptions in

your applications.

Lab -Exception Handling

Page 38: Java Standard Edition SEObject Oriented Programming (OOP) : Learn what an "object oriented program" is, and the benefits they deliver ... managed by the developer. Java, helps us out

Questions?We would like to hear from you

No. 4A Etim Okpoyo Close, By Linjo Super Market,

Bridge Bus-Stop, Aba Express Road, Port Harcourt, Rivers

State

0803 7084 968

0803 0887 945

@loctech

@loctechng

@loctechtraining