Добавить новость
ru24.net
News in English
Июнь
2024

Inheritance in Java, Part 1: The extends keyword

0

Java supports class reuse through inheritance and composition. This two-part tutorial teaches you how to use inheritance in your Java programs.

What you'll learn in this Java tutorial

The first half of this introduction to Java inheritance teaches you how to use the extends keyword to derive a child class from a parent class, invoke parent class constructors and methods, and override methods:

  • What is inheritance in Java?
  • Single inheritance and multiple inheritance
  • How to use the extends keyword in Java
  • Understanding Java class hierarchy
  • When to use method overriding vs. method overloading
download
Download the source code for example applications in this tutorial. Created by Jeff Friesen.

What is inheritance in Java?

Inheritance is a programming construct that software developers use to establish is-a relationships between categories. Inheritance enables us to derive more specific categories from more generic ones. The more specific category is a kind of the more generic category. For example, a checking account is a kind of account in which you can make deposits and withdrawals. Similarly, a truck is a kind of vehicle used for hauling large items.

To read this article in full, please click here




Moscow.media
Частные объявления сегодня





Rss.plus




Спорт в России и мире

Новости спорта


Новости тенниса
Australian Open

Скончался 19-кратный победитель турниров «Большого шлема» Фред Столл






Бышовец — о Тюкавине: надеюсь, мы не потеряем такого выдающегося игрока

ТРАМП ВЫГНАЛ ЗЕЛЕНСКОГО? ЛИБО ЗЕЛЕНСКИЙ ЭТО СДЕЛАЛ, ЧТОБЫ АТАКОВАТЬ США? СЕНСАЦИЯ! Дональд Трамп, Владимир Путин, Илон Маск. Новости. Россия, США, Европа могут улучшить отношения и здоровье общества?!

Российские дамы сейчас согласны зарабатывать меньше мужчин - опрос

Столкновение двух автомобилей парализовало движение на платной дороге в Москве