SlideShare a Scribd company logo
JAVA
FUNDAMENTALS
Eng : Hatem Abd El-Salam
Lecture 7
Agenda
 Wrapper classes
 Abstraction
 Interface
 Delection
© 2016 by Eng. Hatem Abd El-Salam
Wrapper classes
© 2016 by Eng. Hatem Abd El-Salam
Wrapper classes (Cont.)
© 2016 by Eng. Hatem Abd El-Salam
Wrapper classes (Cont.)
© 2016 by Eng. Hatem Abd El-Salam
Abstraction
 Abstraction is a process of hiding the implementation details and showing only
functionality to the user.
 Another way, it shows only important things to the user and hides the internal
details .
for example: sending sms, you just type the text and send the message. You don't
know the internal processing about the message delivery.
 Abstraction lets you focus on what the object does instead of how it does it
© 2016 by Eng. Hatem Abd El-Salam
Abstraction (Cont.)
Ways to achieve Abstraction
 There are two ways to achieve abstraction in java
1. Abstract class (0 to 100%)
2. Interface (100%)
Abstract class in Java
• A class that is declared as abstract is known as abstract class. It needs to be
extended and its method implemented. It cannot be instantiated.
• It can have abstract and non-abstract methods (method with body).
© 2016 by Eng. Hatem Abd El-Salam
Abstraction (Cont.)
Abstract method
 A method that is declared as abstract and does not have implementation is known
as abstract method.
© 2016 by Eng. Hatem Abd El-Salam
© 2016 by Eng. Hatem Abd El-Salam
© 2016 by Eng. Hatem Abd El-Salam
Abstraction (Cont.)
Rules
 If there is any abstract method in a class, that class must be abstract.
 If you are extending any abstract class that have abstract method, you must either
provide the implementation of the method or make this class abstract.
© 2016 by Eng. Hatem Abd El-Salam
Interface
 An interface in java is a blueprint of a class. It has static constants and abstract
methods only.
 The interface in java is a mechanism to achieve fully abstraction. There can be only
abstract methods in the java interface not method body. It is used to achieve fully
abstraction and multiple inheritance in Java.
 Java Interface also represents IS-A relationship.
 It cannot be instantiated just like abstract class.
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
Why use Java interface ?
 There are mainly three reasons to use interface. They are given below.
1. It is used to achieve fully abstraction.
2. By interface, we can support the functionality of multiple inheritance.
3. It can be used to achieve loose coupling.
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
 The java compiler adds public and abstract keywords before the interface method
and public, static and final keywords before data members.
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
Understanding relationship between classes and interfaces
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
Multiple inheritance in Java by interface
© 2016 by Eng. Hatem Abd El-Salam
Interface (Cont.)
© 2016 by Eng. Hatem Abd El-Salam
© 2016 by Eng. Hatem Abd El-Salam
© 2016 by Eng. Hatem Abd El-Salam
Delegation
Q:What are delegates?
When an object receives a request, the object can either handle the request itself or
pass the request on to a second object to do the work. If the object decides to pass
the request on, you say that the object has forwarded responsibility(delegate) for
handling the request to the second object.
Simple examples
© 2016 by Eng. Hatem Abd El-Salam
Complex examples
© 2016 by Eng. Hatem Abd El-Salam
© 2016 by Eng. Hatem Abd El-Salam
Name : Eng. Hatem Abd El-Salam
Email : Hatemabdelsalam@Hotmail.com
LinkedIn : linkedin.com/in/hatemabdelsalam
SlideShare : slideshare.net/HatemAbdElSalam
Contact Details
© 2016 by Eng. Hatem Abd El-Salam

More Related Content

What's hot

Mit103 object oriented programming
Mit103  object oriented programmingMit103  object oriented programming
Mit103 object oriented programming
smumbahelp
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9
DrMohammed Qassim
 
The secret of Functional Programming revealed!
The secret of Functional Programming revealed!The secret of Functional Programming revealed!
The secret of Functional Programming revealed!
Torbjørn Marø
 
Abstract class
Abstract classAbstract class
Abstract class
PhD Research Scholar
 
C#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developersC#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developers
Sanjaya Prakash Pradhan
 
Mit4021–%20 c# and .net
Mit4021–%20 c# and .netMit4021–%20 c# and .net
Mit4021–%20 c# and .net
smumbahelp
 
WHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVAWHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVA
sivasundari6
 
typing tutor presentation
typing tutor presentation typing tutor presentation
typing tutor presentation
Mohsin Khokhar
 
Framework Design Guidelines
Framework Design GuidelinesFramework Design Guidelines
Framework Design Guidelines
Mohamed Meligy
 
Smu bca sem 2 winter 2015 assignments
Smu bca sem 2 winter 2015 assignmentsSmu bca sem 2 winter 2015 assignments
Smu bca sem 2 winter 2015 assignments
solved_assignments
 
Principles in Refactoring
Principles in RefactoringPrinciples in Refactoring
Principles in Refactoring
Chamnap Chhorn
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
Haris Bin Zahid
 
Abstract class and interface
Abstract class and interfaceAbstract class and interface
Abstract class and interface
Mazharul Sabbir
 
Java Interface
Java InterfaceJava Interface
Java Interface
Pushpendra Tyagi
 
C# question answers
C# question answersC# question answers
C# question answers
application developer
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
İbrahim Kürce
 
Ap Power Point Chpt8
Ap Power Point Chpt8Ap Power Point Chpt8
Ap Power Point Chpt8
dplunkett
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++
smumbahelp
 
Code sense
Code senseCode sense
Code sense
nasirj
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
shammi mehra
 

What's hot (20)

Mit103 object oriented programming
Mit103  object oriented programmingMit103  object oriented programming
Mit103 object oriented programming
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9
 
The secret of Functional Programming revealed!
The secret of Functional Programming revealed!The secret of Functional Programming revealed!
The secret of Functional Programming revealed!
 
Abstract class
Abstract classAbstract class
Abstract class
 
C#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developersC#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developers
 
Mit4021–%20 c# and .net
Mit4021–%20 c# and .netMit4021–%20 c# and .net
Mit4021–%20 c# and .net
 
WHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVAWHAT IS ABSTRACTION IN JAVA
WHAT IS ABSTRACTION IN JAVA
 
typing tutor presentation
typing tutor presentation typing tutor presentation
typing tutor presentation
 
Framework Design Guidelines
Framework Design GuidelinesFramework Design Guidelines
Framework Design Guidelines
 
Smu bca sem 2 winter 2015 assignments
Smu bca sem 2 winter 2015 assignmentsSmu bca sem 2 winter 2015 assignments
Smu bca sem 2 winter 2015 assignments
 
Principles in Refactoring
Principles in RefactoringPrinciples in Refactoring
Principles in Refactoring
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Abstract class and interface
Abstract class and interfaceAbstract class and interface
Abstract class and interface
 
Java Interface
Java InterfaceJava Interface
Java Interface
 
C# question answers
C# question answersC# question answers
C# question answers
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
 
Ap Power Point Chpt8
Ap Power Point Chpt8Ap Power Point Chpt8
Ap Power Point Chpt8
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++
 
Code sense
Code senseCode sense
Code sense
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
 

Similar to Java- language Lecture 7

Java- language Lecture 6
Java- language Lecture 6Java- language Lecture 6
Java- language Lecture 6
Hatem Abd El-Salam
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
ssuser84e52e
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
talha ijaz
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)
Professor Lili Saghafi
 
06_OOVP.pptx object oriented and visual programming
06_OOVP.pptx object oriented and visual programming06_OOVP.pptx object oriented and visual programming
06_OOVP.pptx object oriented and visual programming
deffa5
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
TharuniDiddekunta
 
Java interface
Java interface Java interface
Java interface
HoneyChintal
 
Java 6.pptx
Java 6.pptxJava 6.pptx
Java 6.pptx
usmanusman720379
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
bindur87
 
Oop
OopOop
Interface
InterfaceInterface
Interface
Shantilal Bhayal
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
 
Chapter 9 Interface
Chapter 9 InterfaceChapter 9 Interface
Chapter 9 Interface
OUM SAOKOSAL
 
What are abstract classes Dont interfaces also allow for polymo.pdf
What are abstract classes Dont interfaces also allow for polymo.pdfWhat are abstract classes Dont interfaces also allow for polymo.pdf
What are abstract classes Dont interfaces also allow for polymo.pdf
arihantkitchenmart
 
Java abstract Keyword.pdf
Java abstract Keyword.pdfJava abstract Keyword.pdf
Java abstract Keyword.pdf
SudhanshiBakre1
 
Java- language Lecture 5
Java- language Lecture 5Java- language Lecture 5
Java- language Lecture 5
Hatem Abd El-Salam
 
Oops presentation java
Oops presentation javaOops presentation java
Oops presentation java
JayasankarPR2
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
Gradeup
 
Interface in java
Interface in javaInterface in java
Exception handling and packages.pdf
Exception handling and packages.pdfException handling and packages.pdf
Exception handling and packages.pdf
Kp Sharma
 

Similar to Java- language Lecture 7 (20)

Java- language Lecture 6
Java- language Lecture 6Java- language Lecture 6
Java- language Lecture 6
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)
 
06_OOVP.pptx object oriented and visual programming
06_OOVP.pptx object oriented and visual programming06_OOVP.pptx object oriented and visual programming
06_OOVP.pptx object oriented and visual programming
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Java interface
Java interface Java interface
Java interface
 
Java 6.pptx
Java 6.pptxJava 6.pptx
Java 6.pptx
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
Oop
OopOop
Oop
 
Interface
InterfaceInterface
Interface
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Chapter 9 Interface
Chapter 9 InterfaceChapter 9 Interface
Chapter 9 Interface
 
What are abstract classes Dont interfaces also allow for polymo.pdf
What are abstract classes Dont interfaces also allow for polymo.pdfWhat are abstract classes Dont interfaces also allow for polymo.pdf
What are abstract classes Dont interfaces also allow for polymo.pdf
 
Java abstract Keyword.pdf
Java abstract Keyword.pdfJava abstract Keyword.pdf
Java abstract Keyword.pdf
 
Java- language Lecture 5
Java- language Lecture 5Java- language Lecture 5
Java- language Lecture 5
 
Oops presentation java
Oops presentation javaOops presentation java
Oops presentation java
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Exception handling and packages.pdf
Exception handling and packages.pdfException handling and packages.pdf
Exception handling and packages.pdf
 

More from Hatem Abd El-Salam

Java- language Lecture 4
Java- language Lecture 4Java- language Lecture 4
Java- language Lecture 4
Hatem Abd El-Salam
 
Java- language Lecture 3
Java- language Lecture 3Java- language Lecture 3
Java- language Lecture 3
Hatem Abd El-Salam
 
Java- Language Lecture 2
Java- Language Lecture 2Java- Language Lecture 2
Java- Language Lecture 2
Hatem Abd El-Salam
 
Java- language Lecture 1
Java- language Lecture 1Java- language Lecture 1
Java- language Lecture 1
Hatem Abd El-Salam
 
introduction to embedded systems part 2
introduction to embedded systems part 2introduction to embedded systems part 2
introduction to embedded systems part 2
Hatem Abd El-Salam
 
introduction to embedded systems part 1
introduction to embedded systems part 1introduction to embedded systems part 1
introduction to embedded systems part 1
Hatem Abd El-Salam
 
C- language Lecture 8
C- language Lecture 8C- language Lecture 8
C- language Lecture 8
Hatem Abd El-Salam
 
C- language Lecture 7
C- language Lecture 7C- language Lecture 7
C- language Lecture 7
Hatem Abd El-Salam
 
C- language Lecture 6
C- language Lecture 6C- language Lecture 6
C- language Lecture 6
Hatem Abd El-Salam
 
C- language Lecture 5
C- language Lecture 5C- language Lecture 5
C- language Lecture 5
Hatem Abd El-Salam
 
C- language Lecture 4
C- language Lecture 4C- language Lecture 4
C- language Lecture 4
Hatem Abd El-Salam
 
C- language Lecture 3
C- language Lecture 3C- language Lecture 3
C- language Lecture 3
Hatem Abd El-Salam
 
C- Language Lecture 2
C- Language Lecture 2C- Language Lecture 2
C- Language Lecture 2
Hatem Abd El-Salam
 
C-language Lecture 1
C-language Lecture 1C-language Lecture 1
C-language Lecture 1
Hatem Abd El-Salam
 

More from Hatem Abd El-Salam (14)

Java- language Lecture 4
Java- language Lecture 4Java- language Lecture 4
Java- language Lecture 4
 
Java- language Lecture 3
Java- language Lecture 3Java- language Lecture 3
Java- language Lecture 3
 
Java- Language Lecture 2
Java- Language Lecture 2Java- Language Lecture 2
Java- Language Lecture 2
 
Java- language Lecture 1
Java- language Lecture 1Java- language Lecture 1
Java- language Lecture 1
 
introduction to embedded systems part 2
introduction to embedded systems part 2introduction to embedded systems part 2
introduction to embedded systems part 2
 
introduction to embedded systems part 1
introduction to embedded systems part 1introduction to embedded systems part 1
introduction to embedded systems part 1
 
C- language Lecture 8
C- language Lecture 8C- language Lecture 8
C- language Lecture 8
 
C- language Lecture 7
C- language Lecture 7C- language Lecture 7
C- language Lecture 7
 
C- language Lecture 6
C- language Lecture 6C- language Lecture 6
C- language Lecture 6
 
C- language Lecture 5
C- language Lecture 5C- language Lecture 5
C- language Lecture 5
 
C- language Lecture 4
C- language Lecture 4C- language Lecture 4
C- language Lecture 4
 
C- language Lecture 3
C- language Lecture 3C- language Lecture 3
C- language Lecture 3
 
C- Language Lecture 2
C- Language Lecture 2C- Language Lecture 2
C- Language Lecture 2
 
C-language Lecture 1
C-language Lecture 1C-language Lecture 1
C-language Lecture 1
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 

Java- language Lecture 7

  • 1. JAVA FUNDAMENTALS Eng : Hatem Abd El-Salam Lecture 7
  • 2. Agenda  Wrapper classes  Abstraction  Interface  Delection © 2016 by Eng. Hatem Abd El-Salam
  • 3. Wrapper classes © 2016 by Eng. Hatem Abd El-Salam
  • 4. Wrapper classes (Cont.) © 2016 by Eng. Hatem Abd El-Salam
  • 5. Wrapper classes (Cont.) © 2016 by Eng. Hatem Abd El-Salam
  • 6. Abstraction  Abstraction is a process of hiding the implementation details and showing only functionality to the user.  Another way, it shows only important things to the user and hides the internal details . for example: sending sms, you just type the text and send the message. You don't know the internal processing about the message delivery.  Abstraction lets you focus on what the object does instead of how it does it © 2016 by Eng. Hatem Abd El-Salam
  • 7. Abstraction (Cont.) Ways to achieve Abstraction  There are two ways to achieve abstraction in java 1. Abstract class (0 to 100%) 2. Interface (100%) Abstract class in Java • A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated. • It can have abstract and non-abstract methods (method with body). © 2016 by Eng. Hatem Abd El-Salam
  • 8. Abstraction (Cont.) Abstract method  A method that is declared as abstract and does not have implementation is known as abstract method. © 2016 by Eng. Hatem Abd El-Salam
  • 9. © 2016 by Eng. Hatem Abd El-Salam
  • 10. © 2016 by Eng. Hatem Abd El-Salam
  • 11. Abstraction (Cont.) Rules  If there is any abstract method in a class, that class must be abstract.  If you are extending any abstract class that have abstract method, you must either provide the implementation of the method or make this class abstract. © 2016 by Eng. Hatem Abd El-Salam
  • 12. Interface  An interface in java is a blueprint of a class. It has static constants and abstract methods only.  The interface in java is a mechanism to achieve fully abstraction. There can be only abstract methods in the java interface not method body. It is used to achieve fully abstraction and multiple inheritance in Java.  Java Interface also represents IS-A relationship.  It cannot be instantiated just like abstract class. © 2016 by Eng. Hatem Abd El-Salam
  • 13. Interface (Cont.) Why use Java interface ?  There are mainly three reasons to use interface. They are given below. 1. It is used to achieve fully abstraction. 2. By interface, we can support the functionality of multiple inheritance. 3. It can be used to achieve loose coupling. © 2016 by Eng. Hatem Abd El-Salam
  • 14. Interface (Cont.)  The java compiler adds public and abstract keywords before the interface method and public, static and final keywords before data members. © 2016 by Eng. Hatem Abd El-Salam
  • 15. Interface (Cont.) Understanding relationship between classes and interfaces © 2016 by Eng. Hatem Abd El-Salam
  • 16. Interface (Cont.) © 2016 by Eng. Hatem Abd El-Salam
  • 17. Interface (Cont.) Multiple inheritance in Java by interface © 2016 by Eng. Hatem Abd El-Salam
  • 18. Interface (Cont.) © 2016 by Eng. Hatem Abd El-Salam
  • 19. © 2016 by Eng. Hatem Abd El-Salam
  • 20. © 2016 by Eng. Hatem Abd El-Salam
  • 21. Delegation Q:What are delegates? When an object receives a request, the object can either handle the request itself or pass the request on to a second object to do the work. If the object decides to pass the request on, you say that the object has forwarded responsibility(delegate) for handling the request to the second object. Simple examples © 2016 by Eng. Hatem Abd El-Salam
  • 22. Complex examples © 2016 by Eng. Hatem Abd El-Salam
  • 23. © 2016 by Eng. Hatem Abd El-Salam Name : Eng. Hatem Abd El-Salam Email : Hatemabdelsalam@Hotmail.com LinkedIn : linkedin.com/in/hatemabdelsalam SlideShare : slideshare.net/HatemAbdElSalam Contact Details
  • 24. © 2016 by Eng. Hatem Abd El-Salam