Java Abstraction | Java tutorials for beginners

Published: 22 December 2022
on channel: SG Tutorial
2,404
58

Java Abstraction | Java tutorials for beginners
About Video:
This video will show basics of abstraction with real life example as well as pratical example.

To learn about basics of Java click here 👇
Java Basics:    • Java Tutorials for Beginners | Java course...  

Notes:
1. What is Abstraction?
2. Purpose of Abstraction.
3. Advantages
4. Achieve Abstraction using Abstract class.
1.What is Abstraction?
Nowadays,most of us carry very little amount in hand
because we can easily withdraw cash from ATM
and we know that How to use ATM machine?Where to insert ATM card?and Where to enter pin? and Where we can take money?basically we know, how to use atm machine but we don't know How ATM machine work internally?
This means, after inserting card How card details verified ?or When we entered pin then How pin is linked with your bank account?
So How all these things work internally, we don't know,
So basically,here internal working or we can say background details are hidden from users
And shows only essential information to the users that are necessary for users to use ATM machine and this concept is nothing but the abstraction so basically,
Abstraction is the concept of showing only the essential information to the users and hiding background details or implementation from the users.
2.Purpose of Abstraction:
Abstraction Helps to increase the security of an application or program as only showing essential details to the user
This means,
Security is the main purpose of Abstraction.
3.Advantages:
1.It provide security to the application or program.
2.Enhancement.(To know about Enhancement,you can watch the video, everything I have explained there.)
3.It reduces the complexity by hiding unnecessary details and only showing necessary details to the user.
4. Achieve Abstraction using Abstract class :
Let's assume that, you are creating program for ATM Machine.
//Abstract class
abstract class User{
// Abstract method
abstract void insertCard();
// Non-abstract method
void displayMsg() {
System.out.println("Welcome User");
}
}
class Test1 extends User{
void insertCard(){
System.out.println("Please insert card");
}
}
class Test{
public static void main(String[] args){
Test1 test1 = new Test1();
test1.displayMsg();
test1.insertCard();
}
}
Output:
Welcome User
Please,insert card
In the above example,there is one User class which is abstract and inside User class there is one insert card() method which is abstract and in tha same class there is one non abstract method also and it's displayMsg() which has its body/ implementation whereas abstract method doesn't has it's implementation and also create Test1 class which extends abstract class i.e User class and provide implementation for abstract method of User class and create one more class and it's Test class to put all executable code and create object of Test1 class and call the methods of abstract class to get desired output ( To understand more clearly please watch video completely)
-------------------------------------------------------------------------------------------------------------------
Thank you so much🙏

#abstractuoninjava #javaabstraction #abstractclassinjava #javaabatractclass#abstractmethodinjava #javaabstractmethod #sgtutorial #javawithnotes #javanotes #oopsabstraction
#useofabstraction #javaabstractionexample
#javaabstractiontutorial #javaabstractionwithexample


On this page of the site you can watch the video online Java Abstraction | Java tutorials for beginners with a duration of hours minute second in good quality, which was uploaded by the user SG Tutorial 22 December 2022, share the link with friends and acquaintances, this video has already been watched 2,404 times on youtube and it was liked by 58 viewers. Enjoy your viewing!