SlideShare a Scribd company logo
Packages
&
Interfaces
Presented by: Anindita Mandal
Amar Kr Soni
Alekhya Pandey
Akashdeep Singha Roy
Akash Das
Akansha Kumari
Aishik Das
What are ‘Packages’
in JAVA?A Package can be defined as a grouping of related types (classes, interfaces, enumerations and annotations )
providing access protection and namespace management.
It can be further categorized in two
types:
• We were storing all the coded files inside the same directory, what if, someday we need to
make a project?
• As the applications grows it becomes difficult to keep all the files in same directory, also we need to
ensure that the name we choose should be unique. To address this problem java introduces a mechanism
to manage all the classes this is called Packages
 What does it mean
actually?
• Let’s see…
Directory Structure showing the inbuilt
packages
• Now, the inbuilt packages will be available to user with all use cases, but what if we need to do
something which is not pre-defined?
• We’ll be creating our own packages.
• Lets see how!
By default I wrote all files here inside this directory.
Now if I’ve to create a package.
Firstly, creating a new directory
Creating new files inside the
directory
Now, the package
name should be the
same as directory
name
• Now, if we want to access the
package
Test.*;
Represents all files
inside the Test directory
On running this, we get
Inside Test, class sample
is present.
By this we can observe that the package is properly imported.
What are ‘Interfaces’ in
JAVA?• An interface in java is a blueprint of a class.
• It has static constants and abstract methods.
• The interface in java is a mechanism to achieve abstraction.
Just like a class can inherit or extend from another class, similarly the interface can inherit or extend from another interface
 How do we declare an
interface?• Let’s see the syntax for writing an interface…
• An interface is implicitly abstract.
• So not need to use the abstract keyword while declaring an interface.
• Each Fields in an interface is also implicitly static and final, so the static and final keyword is
not needed (Refer below diagram).
• Methods in an interface are also implicitly public.
Creating an interface
Implementing the interface
Completing the body of
the abstract method
After running the program
Interface helps us getting an implementation of
multi-parent inheritance which is not there in JAVA
References
 https://www.javatpoint.com/package
 https://www.tutorialspoint.com/java/java_packages.htm
 https://www.geeksforgeeks.org/packages-in-java/
 https://docs.oracle.com/javase/tutorial/java/concepts/package.html
 https://www.geeksforgeeks.org/interfaces-in-java/
 https://www.javatpoint.com/interface-in-java
 https://www.tutorialspoint.com/java/java_interfaces.htm
Thank You
“I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge.
Knowledge is limited.
Imagination encircles the world.”
― AlbertEinstein
Now, thought for the day,

More Related Content

PPTX
Packages and interfaces
PDF
JAVA PROGRAMMING – Packages - Stream based I/O
PDF
Java packages
DOCX
Class notes(week 7) on packages
PPT
Packages in java
PPTX
Pi j4.1 packages
PPTX
Unit3 part3-packages and interfaces
PDF
Java - Interfaces & Packages
Packages and interfaces
JAVA PROGRAMMING – Packages - Stream based I/O
Java packages
Class notes(week 7) on packages
Packages in java
Pi j4.1 packages
Unit3 part3-packages and interfaces
Java - Interfaces & Packages

What's hot (20)

PPTX
Introduction to java
PPTX
Unit 5 java-awt (1)
PPTX
OCA JAVA - 1 Packages and Class Structure
PPTX
Unit3 packages & interfaces
PPTX
java interface and packages
PPTX
Inner classes in java
PPTX
Structure of java program diff c- cpp and java
PPT
packages and interfaces
PPTX
Object oriented programming in java
PPT
Packages in java
PPTX
Java package
PDF
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
PPTX
5.interface and packages
PPTX
C# classes objects
PDF
Packages
PDF
Java programming -Object-Oriented Thinking- Inheritance
PPTX
Packages in java
PPT
Java access modifiers
PPSX
Java Object Oriented Programming
PDF
Oops concepts || Object Oriented Programming Concepts in Java
Introduction to java
Unit 5 java-awt (1)
OCA JAVA - 1 Packages and Class Structure
Unit3 packages & interfaces
java interface and packages
Inner classes in java
Structure of java program diff c- cpp and java
packages and interfaces
Object oriented programming in java
Packages in java
Java package
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
5.interface and packages
C# classes objects
Packages
Java programming -Object-Oriented Thinking- Inheritance
Packages in java
Java access modifiers
Java Object Oriented Programming
Oops concepts || Object Oriented Programming Concepts in Java
Ad

Similar to Packages and Interfaces (20)

PPT
Packages,interfaces and exceptions
PPTX
Objects and classes in OO Programming concepts
PPTX
Chap1 packages
PPTX
OBJECT ORIENTED PROGRAMMING Unit2 second half.pptx
PPTX
Z blue interfaces and packages (37129912)
PDF
Unit 2 notes.pdf
PPTX
Interface &packages
PPTX
Unit II Inheritance ,Interface and Packages.pptx
PPT
Unit 4 Java
PPT
Packages and interfaces
PPT
7.Packages and Interfaces(MB).ppt .
DOCX
Unit4 java
PPT
Packages in java
PPTX
Packages in java
PDF
Java - Packages Concepts
PPTX
Packages and interfaces
PPTX
10-Lecture10_Leeeeeeeeeeeeeeeecture.pptx
PPTX
Lecture 19
PPTX
java package in java.. in java packages.
PPTX
java package java package in java packages
Packages,interfaces and exceptions
Objects and classes in OO Programming concepts
Chap1 packages
OBJECT ORIENTED PROGRAMMING Unit2 second half.pptx
Z blue interfaces and packages (37129912)
Unit 2 notes.pdf
Interface &packages
Unit II Inheritance ,Interface and Packages.pptx
Unit 4 Java
Packages and interfaces
7.Packages and Interfaces(MB).ppt .
Unit4 java
Packages in java
Packages in java
Java - Packages Concepts
Packages and interfaces
10-Lecture10_Leeeeeeeeeeeeeeeecture.pptx
Lecture 19
java package in java.. in java packages.
java package java package in java packages
Ad

Recently uploaded (20)

PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
PDF
The Future of Smart Factories Why Embedded Analytics Leads the Way
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PPTX
Save Business Costs with CRM Software for Insurance Agents
DOCX
The Future of Smart Factories Why Embedded Analytics Leads the Way
PPTX
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
PDF
Comprehensive Salesforce Implementation Services.pdf
PPTX
AIRLINE PRICE API | FLIGHT API COST |
PPTX
How a Careem Clone App Allows You to Compete with Large Mobility Brands
PPTX
Computer Hardware tool: hand tools, diagnostics, ESD and cleaning tools
PDF
A Practical Breakdown of Automation in Project Management
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
Using Bootstrap to Make Accessible Front-Ends(2).pptx
PPTX
Dynamic Solutions Project Pitch Presentation
PDF
Rise With SAP partner in Mumbai.........
PDF
Become an Agentblazer Champion Challenge Kickoff
Micromaid: A simple Mermaid-like chart generator for Pharo
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
The Future of Smart Factories Why Embedded Analytics Leads the Way
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Save Business Costs with CRM Software for Insurance Agents
The Future of Smart Factories Why Embedded Analytics Leads the Way
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
Comprehensive Salesforce Implementation Services.pdf
AIRLINE PRICE API | FLIGHT API COST |
How a Careem Clone App Allows You to Compete with Large Mobility Brands
Computer Hardware tool: hand tools, diagnostics, ESD and cleaning tools
A Practical Breakdown of Automation in Project Management
How Creative Agencies Leverage Project Management Software.pdf
Best Practices for Rolling Out Competency Management Software.pdf
A REACT POMODORO TIMER WEB APPLICATION.pdf
Using Bootstrap to Make Accessible Front-Ends(2).pptx
Dynamic Solutions Project Pitch Presentation
Rise With SAP partner in Mumbai.........
Become an Agentblazer Champion Challenge Kickoff

Packages and Interfaces

  • 1. Packages & Interfaces Presented by: Anindita Mandal Amar Kr Soni Alekhya Pandey Akashdeep Singha Roy Akash Das Akansha Kumari Aishik Das
  • 2. What are ‘Packages’ in JAVA?A Package can be defined as a grouping of related types (classes, interfaces, enumerations and annotations ) providing access protection and namespace management. It can be further categorized in two types:
  • 3. • We were storing all the coded files inside the same directory, what if, someday we need to make a project? • As the applications grows it becomes difficult to keep all the files in same directory, also we need to ensure that the name we choose should be unique. To address this problem java introduces a mechanism to manage all the classes this is called Packages  What does it mean actually? • Let’s see… Directory Structure showing the inbuilt packages
  • 4. • Now, the inbuilt packages will be available to user with all use cases, but what if we need to do something which is not pre-defined? • We’ll be creating our own packages. • Lets see how! By default I wrote all files here inside this directory. Now if I’ve to create a package. Firstly, creating a new directory Creating new files inside the directory Now, the package name should be the same as directory name
  • 5. • Now, if we want to access the package Test.*; Represents all files inside the Test directory On running this, we get Inside Test, class sample is present. By this we can observe that the package is properly imported.
  • 6. What are ‘Interfaces’ in JAVA?• An interface in java is a blueprint of a class. • It has static constants and abstract methods. • The interface in java is a mechanism to achieve abstraction. Just like a class can inherit or extend from another class, similarly the interface can inherit or extend from another interface
  • 7.  How do we declare an interface?• Let’s see the syntax for writing an interface… • An interface is implicitly abstract. • So not need to use the abstract keyword while declaring an interface. • Each Fields in an interface is also implicitly static and final, so the static and final keyword is not needed (Refer below diagram). • Methods in an interface are also implicitly public.
  • 8. Creating an interface Implementing the interface Completing the body of the abstract method After running the program Interface helps us getting an implementation of multi-parent inheritance which is not there in JAVA
  • 9. References  https://www.javatpoint.com/package  https://www.tutorialspoint.com/java/java_packages.htm  https://www.geeksforgeeks.org/packages-in-java/  https://docs.oracle.com/javase/tutorial/java/concepts/package.html  https://www.geeksforgeeks.org/interfaces-in-java/  https://www.javatpoint.com/interface-in-java  https://www.tutorialspoint.com/java/java_interfaces.htm
  • 10. Thank You “I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.” ― AlbertEinstein Now, thought for the day,