Basic computer course, C programming language, Education, Engineering Course, Engineering Courses, Maths Coaching, online computer coaching, PGDCA course coaching, programming course, school computer coaching, training, Uncategorized, Web Design course

What-is-the-difference-between-packages-and-interfaces-in-Java?tccicomputercoaching.com

packages and Interfaces both acts as a container. The content in packages and interfaces can be used by the classes by importing and implementing it correspondingly.

Let us see Difference between Package and Interface.

1. Definition:

Packages is a group of classes and/or interfaces together. The classes in packages are related to each other in some scope or by inheritance.

Interfaces is a group of abstract methods and constant fields. The methods declared in
the interface are abstract that means the methods are only declared but not defined. The fields in the interface are always public, static, final. The fields must be initialized at the time of declaration.

2. How to Create?

Packages are created using “Package” keyword.

Interface are created using “Interface” keyword.

3. Syntax:

a.

package package_name;
public class class_name

{.(body of class).}

b.

interface interface_name

{variable declaration;
method declaration;}

4. Access keyword:

a. A Packages can be imported using “import” keyword.

b. An interface can be extended by another interface and implemented by the class.

Interfaces can be implemented using “implement” keyword.

5. Basic Difference

Package is a Group of classes and interface.

When class implement interface.

TCCI Computer Coaching Class teach Java Language in Bopal and Satellite in Ahmedabad to the Computer-IT Engineering, BCA, PGDCA,Diploma Engineering,School Students and any Non-IT person.

To know more in detail about Package and interface in Java.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s