Презентация Java 4 WEB. Lesson 3 - OOP онлайн
На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему Java 4 WEB. Lesson 3 - OOP абсолютно бесплатно. Урок-презентация на эту тему содержит всего 46 слайдов. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.
Презентации » Устройства и комплектующие » Java 4 WEB. Lesson 3 - OOP
Оцените!
Оцените презентацию от 1 до 5 баллов!
- Тип файла:ppt / pptx (powerpoint)
- Всего слайдов:46 слайдов
- Для класса:1,2,3,4,5,6,7,8,9,10,11
- Размер файла:644.24 kB
- Просмотров:102
- Скачиваний:0
- Автор:неизвестен
Слайды и текст к этой презентации:
№4 слайд
![Abstract Classes May contain](/documents_6/970d7c91ff2885a59ee5af16999a5801/img3.jpg)
Содержание слайда: Abstract Classes
May contain any number of methods including zero
If class has at least one abstract method – class is abstract
abstract void clean()
Abstract methods may not appear in a class that is not abstract
The first concrete subclass of an abstract class is required to implement all abstract methods that were not implemented by a superclass
№8 слайд
![Overriding rules The access](/documents_6/970d7c91ff2885a59ee5af16999a5801/img7.jpg)
Содержание слайда: Overriding rules
The access modifier must be the same or more accessible;
The return type must be the same or a more restrictive type, also known as covariant return types;
If any checked exceptions are thrown, only the same exceptions or subclasses of those exceptions are allowed to be thrown;
The methods must not be static. (If they are, the method is hidden and not overridden);
@Override - It is a great idea to get in the habit of using it in order to avoid accidentally overloading a method.
№10 слайд
![Overloading precedence class](/documents_6/970d7c91ff2885a59ee5af16999a5801/img9.jpg)
Содержание слайда: Overloading precedence
class Overloading {
static void overloadedMethod(int i) { // will enter if nothing is commented
System.out.println("in int");
}
static void overloadedMethod(long i) { // will enter if comment 'int'
System.out.println("in long");
}
static void overloadedMethod(Integer i) { // will enter if comment 'int' and 'long'
System.out.println("in Integer");
}
static void overloadedMethod(Number i) { // will enter if comment 'int', 'long' and 'Integer'
System.out.println("in Number");
}
static void overloadedMethod(int... i) { // will enter if comment 'int', 'long', 'Integer' and 'Number'
System.out.println("in var arg");
}
public static void main(String[] args) {
overloadedMethod(10);
}
}
№11 слайд
![Interface Defines a set of](/documents_6/970d7c91ff2885a59ee5af16999a5801/img10.jpg)
Содержание слайда: Interface
Defines a set of public abstract methods, which classes implementing the interface must provide.
Allows you to define what a class can do without saying how to do it (interface is a contract)
A class may implement multiple interfaces as well as extend classes that implement interfaces, allowing for limited multiple inheritance in Java
May extend other interfaces, although they may not extend a class and vice versa
May contain public static final constant values, public and private methods, public default methods.
№12 слайд
![Interface interface Walk int](/documents_6/970d7c91ff2885a59ee5af16999a5801/img11.jpg)
Содержание слайда: Interface
interface Walk {
int someConst = 1;
public static final int anotherConst = 1;
boolean isQuadruped();
private void doSomething() {
//do some work
}
abstract double getMaxSpeed();
}
interface Run extends Walk {
public abstract boolean canHuntWhileRunning();
default double getMaxSpeed(){
return 1;
}
}
№13 слайд
![Interface Provides a way for](/documents_6/970d7c91ff2885a59ee5af16999a5801/img12.jpg)
Содержание слайда: Interface
Provides a way for one individual to develop code that uses another individual’s code, without having access to the other individual’s underlying implementation. Interfaces can facilitate rapid application development by enabling development teams to create applications in parallel, rather than being directly dependent on each other (for example one team uses interface, another team implements it)
№15 слайд
![Nested Classes Types of](/documents_6/970d7c91ff2885a59ee5af16999a5801/img14.jpg)
Содержание слайда: Nested Classes
Types of nested classes:
A member inner class is a class defined at the same level as instance variables. It is not static. Often, this is just referred to as an inner class without explicitly saying the type.
A local inner class is defined within a method.
An anonymous inner class is a special case of a local inner class that does not have a name.
A static nested class is a static class that is defined at the same level as static variables.
№17 слайд
![Member Inner Classes class A](/documents_6/970d7c91ff2885a59ee5af16999a5801/img16.jpg)
Содержание слайда: Member Inner Classes
class A {
private int x = 1;
class B {
private int x = 2;
class C {
private int x = 3;
public void printAll() {
System.out.println(x); // 3
System.out.println(this.x); // 3
System.out.println(B.this.x); // 2
System.out.println(A.this.x); // 1
}
}
}
}
№22 слайд
![Enum enum Planet implements](/documents_6/970d7c91ff2885a59ee5af16999a5801/img21.jpg)
Содержание слайда: Enum
enum Planet implements IGravitable {
MERCURY (3.303e+23, 2.4397e6) {
@Override
double surfaceGravity() {
return -1;
}
},
VENUS (4.869e+24, 6.0518e6),
EARTH (5.976e+24, 6.37814e6)
// ...
;
private double mass; // in kilograms
final double radius; // in meters
Planet(double mass, double radius) {// private
this.mass = mass;
this.radius = radius;
}
// universal gravitational constant (m3 kg-1 s-2)
public static final double G = 6.67300E-11;
@Override
double surfaceGravity() {
return G * mass / (radius * radius);
}
}
№30 слайд
![Encapsulation No actor other](/documents_6/970d7c91ff2885a59ee5af16999a5801/img29.jpg)
Содержание слайда: Encapsulation
No actor other than the class itself should have direct access to its data. The class is said to encapsulate the data it contains and prevent anyone from directly accessing it.
With encapsulation, a class is able to maintain certain invariants about its internal data. An invariant is a property or truth that is maintained even after the data is modified.
№31 слайд
![Encasulation example class](/documents_6/970d7c91ff2885a59ee5af16999a5801/img30.jpg)
Содержание слайда: Encasulation example
class CoffeeMachine {
private int sugar;
private double milk;
Coffee makeCoffee(){
blendBeans();
heatWater();
shakeMilk();
return mix();
}
private Coffee mix() {
return new Coffee(); // mix all together
}
private void shakeMilk() {
// shaking milk
}
private void heatWater() {
// heating water
}
private void blendBeans() {
// blending beans
}
}
№35 слайд
![Polymorphism An object in](/documents_6/970d7c91ff2885a59ee5af16999a5801/img34.jpg)
Содержание слайда: Polymorphism
An object in Java may take on a variety of forms, in part depending on the reference used to access the object.
One name, many forms. Polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.
There are 2 basic types of polymorphism.
Overriding, also called run-time (dynamic) polymorphism.
Overloading, which is referred to as compile-time (static) polymorphism.
№42 слайд
![Composition has-a Object](/documents_6/970d7c91ff2885a59ee5af16999a5801/img41.jpg)
Содержание слайда: Composition (has-a)
Object composition is the idea of creating a class by connecting other classes as members using the has‐a principle.
Inheritance is the idea of creating a class that inherits all of its reusable methods and objects from a parent class.
Both are used to create complex data models, each with its own advantages and disadvantages
№45 слайд
![Homework Implement classes](/documents_6/970d7c91ff2885a59ee5af16999a5801/img44.jpg)
Содержание слайда: Homework
Implement classes: SUV, Sedan, Hatchback3Doors, Hatchback5Doors
SUV, Sedan, Hatchback3Doors, Hatchback5Doors should extend Vehicle
Vehicle provides info: name, max passengers number, number of doors
Vehicle should implement Drivable
Each Vehicle contains Accelerator, BrakePedal, Engine, GasTank, SteeringWheel
Implement Accelerator, BrakePedal, Engine, GasTank, SteeringWheel according to their names:
Accelerator works 5 seconds (5 times) and speed-up the car for a some accelerateStrength
BrakePedal slow down the car for a some brakingStrength
Engine hat it capacity, max speed, can be started or stopped, uses fuel from GasTank when work
GasTank has it max and current volumes, GasTank can use fuel or can be filled by it
SteeringWheel has it max turn angle, current turn angle and step (one turn changes the current angle for this value), SteeringWheel can be turned left or right
Verify all properties of each car part they cannot be greater than some max value and less than some min value (see tests); speed, volume cannot be negative or greater than max speed and/or volume
Engine, GasTank, SteeringWheel should implement interface StatusAware
Create class ControlPanel that must control the Drivable regardless of what type of vehicle it is transmitted
Скачать все slide презентации Java 4 WEB. Lesson 3 - OOP одним архивом:
Похожие презентации
-
Java 4 WEB. Lesson 10 - IO, NIO
-
Java 4 WEB
-
Java for web. Js & ajax
-
Java for web. Json
-
Java for web. Junit
-
Основы языка Java. Введение в Web-технологии Java SE, Java EE, Java ME
-
Arrays Loops. Java Core
-
Web-технологии: HTML, CSS, JavaScript, JQuery
-
Introduction to JavaScript. OOP in JavaScript
-
Разработка Internet- и Web-приложений. Изучаем JavaScript. (Лекция 4)