Module 4_Ch3 - Abstraction and Encapsulation.pptx

jhesorleylaid2 8 views 7 slides Sep 06, 2024
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

Encapsulation and Abstraction


Slide Content

MODULE 4 JAVA CLASSES AND METHODS CHAPTER 3 Abstraction and Encapsulation

Abstraction 4. Java Classes and Methods Data abstraction is the process of hiding certain details and showing only essential information to the user Can be achieved with either abstract classes or interfaces Use abstract keyword to define an abstract class

Abstract Class 4. Java Classes and Methods Abstract class cannot be used to instantiate an object Must be inherited from another class Abstract class may or may not include abstract methods

Abstract Method 4. Java Classes and Methods Only used inside a given abstract class It does not contain any body When a subclass inherited this abstract class it will ask to override the given method

Encapsulation 4. Java Classes and Methods Make data hidden (by declaring the properties as private) When data is said to be private you can access those data through standard methods called the setter (write) and getter (read) Better Control Secured Data Flexible

Coding Simulation 4. Java Classes and Methods

Sources https://www.tutorialspoint.com/java/index.htm https://www.javatpoint.com/java-tutorial https://dev.java/learn/getting-started/ https://www.w3schools.com/java/default.asp Next Chapter: Polymorphism and Inheritance 4. Java Classes and Methods
Tags