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...

Programming w/ Professor Sluiter5.0K views12:54

🔥 Related Trending Topics

LIVE TRENDS

This 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