Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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;
} Advertisements
