Interface and Abstract class examples in Java
Examples of abstract classes compared and contrasted to interface classes in Java. An abstract class defines a parent model. For example, a vehicle is an a...
🔥 Related Trending Topics
LIVE TRENDSThis video may be related to current global trending topics. Click any trend to explore more videos about what's hot right now!
THIS VIDEO IS TRENDING!
This video is currently trending in Thailand under the topic 'สภาพอากาศ'.
About this video
Examples of abstract classes compared and contrasted to interface classes in Java.
An abstract class defines a parent model. For example, a vehicle is an abstract idea. Cars, trucks, airplanes, bicycles are all implementations of the abstract idea of a vehicle. Another example is user account. There may be subclasses of the abstract such as admin account, student account, teacher account, customer account, sales person account. In a program, each of these types of accounts would share the same parent. The program could create instances of these account types but would never create an instance of the abstract class "user account". In Java, a class can inherit from only one parent. A class can implement many interfaces though.
An interface is like a blueprint for a class. An interface usually has a list of method names, but does not include any code. For example, an interface called "ManageData" might have the methods - readOneRecord, readAllRecords, writeOne, writeAll, deleteOne etc. Any class that implements the ManageData interface must have a method for readOneRecord, readAllRecords, writeOne, writeAll, deleteOne. We might have a class called FileIODataManager which uses text files to do all of these operations. Another class called DataBaseDataManger could also implement these same methods but would communicate with a mySQL database server to do the operations. The two classes have the exact same collection of method names but are doing the work in completely different ways.
This video is part of a series on Java programming.
Video Information
Views
5.0K
Total views since publication
Likes
87
User likes and reactions
Duration
12:54
Video length
Published
Sep 20, 2019
Release date
Quality
hd
Video definition
About the Channel
Tags and Topics
This video is tagged with the following topics. Click any tag to explore more related content and discover similar videos:
#java #interface #inheritance #abstract class #interface in java #interface vs abstract class in java #abstract class vs interface java #interface and abstract class in java #abstract method #abstract class in java #abstract class in c# #interface explained #abstract program in java example #abstract program in java #java interfaces explained #java interface tutorial #java interface #implements java #object oriented programming java #abstract vs interface #interface vs abstrct
Tags help categorize content and make it easier to find related videos. Browse our collection to discover more content in these categories.