Java inheritance

Java inheritance

Bro Code

3 года назад

246,132 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Bro Code
Bro Code - 28.09.2020 21:35

//*************************************
public class Main {

public static void main(String[] args) {

// inheritance = the process where one class acquires,
// the attributes and methods of another.

Car car = new Car();

car.go();

Bicycle bike = new Bicycle();

car.go();
bike.stop();

System.out.println(car.doors);
System.out.println(bike.pedals);

}
}
//*************************************
public class Vehicle{
double speed;

void go(){
System.out.println("This vehicle is moving");
}
void stop(){
System.out.println("This vehicle is stopped");
}
}
//*************************************
public class Car extends Vehicle{
int wheels = 4;
int door = 4;
}
//*************************************
public class Bicycle extends Vehicle{
int wheels = 2;
int pedals = 2;
}
//*************************************

Ответить
abnew S
abnew S - 03.11.2023 19:03

Tank you, very excellent explanation

Ответить
Madhushree Banerjee
Madhushree Banerjee - 02.11.2023 16:37

Love from India❤

Ответить
Firas Faham فراس فحام
Firas Faham فراس فحام - 21.10.2023 02:04

Correction: in the void main, looking at the end of main, the "s" need to be removed from "car.doors" so the correct line should look like: System.out.println(car.door);

Ответить
lucreatia Alexander
lucreatia Alexander - 20.10.2023 01:37

Thank you so much for this tutorial!! It was very comprehensive and helpful.

Ответить
Minhaj uddin
Minhaj uddin - 16.10.2023 08:53

very good video
helpful it is

Ответить
Prithvi Aj
Prithvi Aj - 15.10.2023 10:50

👍

Ответить
chi chung
chi chung - 12.10.2023 13:29

Thanks

Ответить
Ahmad Serhan
Ahmad Serhan - 05.10.2023 13:25

Very easiy explaing thank you

Ответить
Benjamín Gonzalez
Benjamín Gonzalez - 05.10.2023 04:38

😎

Ответить
tamana radmanish
tamana radmanish - 28.09.2023 20:12

Thank you 🥰

Ответить
Caleb
Caleb - 23.09.2023 20:27

You made that look easy! Thank you!!!

Ответить
a v
a v - 22.09.2023 11:36

thank you

Ответить
Savage Desuyoooooo
Savage Desuyoooooo - 21.09.2023 21:59

good stuff

Ответить
Sean Brinker
Sean Brinker - 15.09.2023 04:28

Your 6-minute video made the bootcamp LMS content much easier to understand. Much appreciated!

Ответить
Keiru Cabili
Keiru Cabili - 14.09.2023 05:52

I love u bro

Ответить
Dylan Lorrenzo
Dylan Lorrenzo - 09.09.2023 18:02

thank you ganteng

Ответить
natimisrak
natimisrak - 07.09.2023 12:42

bro

Ответить
jaziel garcia
jaziel garcia - 05.09.2023 01:35

thanks for making it so easy to understand, awesome video, no more neither less information of what i needed

Ответить
Marvin Arias
Marvin Arias - 28.08.2023 22:07

Cool work!

Ответить
Larry S
Larry S - 14.08.2023 07:00

fucking goat.

Ответить