240 likes | 257 Views
Abstraction is one of the keys to achieving the Object-Oriented Programming approach to design, develop, and deploy software. This technique is really important and many developed intend to have a strong grip on it. This video will give you an idea about the best practices and suggestions that could help you to use abstract classes in Java.<br><br>About Simplilearn Java certification training course:<br>If youu2019re looking to master web application development for virtually any computing platform, this Java Certification Training course is for you. This all-in-one Java training will give you a firm foundation in Java, the most commonly used programming language in software development.<br><br>This advanced Java Certification Training course is designed to guide you through the concepts of Java from introductory techniques to advanced programming skills. The course will provide you with the knowledge of Core Java 8, operators, arrays, loops, methods, and constructors while giving you hands-on experience in JDBC and JUnit framework.<br><br>Java Certification Course Key Features:<br>1. 70 hours of blended training<br>2. Hands-on coding and implementation of two web-based projects<br>3. Includes Hibernate and Spring frameworks<br>4. 35 coding-related exercises on Core Java 8<br>5. Lifetime access to self-paced learning<br>6. Flexibility to choose classes<br><br>Eligibility:<br>Simplilearnu2019s Java Certification Training course is ideal for software developers, web designers, programming enthusiasts, engineering graduates, and students or professionals who wish to become Java developers.<br><br>Pre-requisites:<br>Prior knowledge of Core Java is a prerequisite to taking this advanced Java Certification training course. Our Core Java online self-paced course is available for free to become familiar with the basics of Java programming.<br><br>ud83dudc49Learn more at: https://bit.ly/3b6SCvp<br><br>
E N D
Agenda What is an Abstract Class? Features of Abstract Classes Rules to declare Abstract Classes Disadvantages of Abstract Classes Procedure to achieve Abstraction in Java Interface v/s Abstract Class The Syntax for Abstract Classes Interface Examples for Abstract Classes Advantages of Abstract Classes
What Is an Abstract Class? Abstract class in Java is considered as a template of methods and variables used in a program. Abstract classes cannot be instantiated directly.
Features of Abstract class Template Loose Coupling Code Reusability Abstraction Dynamic Resolution
Rules to Declare an Abstract Class • The keyword “abstract” is mandatory. • Abstract classes cannot be instantiated. • An abstract class must have at least one abstract method. • An abstract class includes final methods. • An abstract class may also include non-abstract methods. • Abstract class can include constructors and static methods.
Procedure Procedure to Achieve Abstraction
Procedure Procedure to Achieve Abstraction • Abstraction is one of the fundamentals of Object-oriented programming. Abstraction can be achieved by following either of the two below mentioned procedures. • Using an Interface • Using an Abstract Class
Syntax of Abstract Class • Abstraction can be achieved by following the syntax mentioned below. • abstract class Simplilearn{} • abstract void Simplilearn();
Interface Interface can be defined as a boundary between the method and the class implementing it. In Java, we use interface to achieve abstraction
Syntax of Interface • Abstraction can be achieved by following the syntax mentioned below. • interface Simplilearn{}
I Interface V/S Abstract Class
Interface V/S Abstract Class Interface Abstract I Keyword: interface Keyword: abstract Subclasses extend it Subclasses implement it Only one abstract class can be extended Multiple interfaces can be implemented Does not support multiple inheritance Supports multiple inheritance
Advantages of Abstract Class • Highly beneficial in writing shorter codes • Avoids code duplication • Enables code Reusability • Changes to Internal code implementation is done without affecting classes
Disadvantages of Abstract Class • Abstraction is expensive as sometimes you need to handle cases and situation which are not necessary sometimes. • Object relational impedance mismatch in case of RDBMS • Object relational Mapping in case of Frameworks like hibernate