Object Oriented Programming

Слайд 2

Consider the following points Wrapper Classes Dates and Times Inheritance Encapsulation Polymorphism

Consider the following points

Wrapper Classes
Dates and Times
Inheritance
Encapsulation
Polymorphism

Слайд 3

Wrapper Classes

Wrapper Classes

Слайд 4

Converting from a String

Converting from a String

Слайд 5

Dates and Times

Dates and Times

Слайд 6

Periods

Periods

Слайд 7

Formatting

Formatting

Слайд 8

Parsing Dates and Times

Parsing Dates and Times

Слайд 9

Inheritance Inheritance is the process by which the new child subclass

Inheritance

Inheritance is the process by which the new child subclass automatically

includes any public or protected primitives, objects or methods defined in the parent class.
Слайд 10

Encapsulation Encapsulation in Java is a mechanism of wrapping the data

Encapsulation

Encapsulation in Java is a mechanism of wrapping the data (variables)

and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.
Слайд 11

Access Modifiers public – from any class protected – from classes

Access Modifiers

public – from any class
protected – from classes in the

same package or subclasses
default (package private) access - from classes in the same package
private – from within the same class
Слайд 12

Polymorphism Polymorphism in Java is a concept by which we can

Polymorphism

Polymorphism in Java is a concept by which we can perform

a single action in different ways.
There are two types of polymorphism in Java
compile-time
runtime
Слайд 13

Overloading Should be different types of parameters numbers of parameters Can

Overloading

Should be different
types of parameters
numbers of parameters
Can be different
access modifiers
optional specifiers
return

types
exception lists
Слайд 14

Order Java uses to choose the right overloaded method Exact match

Order Java uses to choose the right overloaded method

Exact match

by type
Larger primitive type
Autoboxed type
Varargs
Слайд 15

Overriding methods The method in the child class must have the

Overriding methods

The method in the child class must have

the same signature as the method in the parent class
The method in the child class must be at least as accessible or more accessible then the method in the parent class
If the method returns a value, it must be the same or a subclass of the method in the parent class, known as covariant return types
The method defined in the child class must be marked as static if it is marked as static in the parent class and otherwise.