
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Packages and Interfaces in Java
In this post, we will understand the difference between packages and interfaces in Java.
Packages
It is a group of classes and/or interfaces that are together.
It can be created using the "Package" keyword.
It can be imported.
It can be done using the "import" keyword.
Example
package package_name; public class class_name { . (body of class) . }
Interfaces
It is a group of abstract methods and constants.
It can be created using the "Interface" keyword.
It can be extended by another interface.
It can also be implemented by a class.
It can be implemented using the ‘implement’ keyword.
Example
interface interface_name { variable declaration; method declaration; }
- Related Questions & Answers
- Difference between namespace in C# and packages in Java
- What is the difference between Externalizable and Serializable interfaces in Java?
- What is the difference between interfaces and abstract classes in Java?
- Creating and using packages in Java
- Packages in Java
- Interfaces and inheritance in Java Programming
- Interfaces in Java
- Explain packages in Java
- Difference between Java and JavaScript.
- Difference between Go and Java.
- Difference Between C++ and Java
- Difference between Java and C language
- Difference between constructor and method in Java
- Difference between HashMap and HashTable in Java.
- Difference between StringBuilder and StringBuffer in Java
Advertisements