answersLogoWhite

0


Best Answer

A package is just a mechanism for grouping

objects, it is very similar to grouping items

within a folder or directory on a file system. A class is found within a package, but this does not

have an impact on the class' behavior (review the

"package" access level for a slight exception). An interface, however, is a .java file that is used

(implemented) by another class to tell the outside

world that it conforms to a certain specification. For

example, you might have a "Runnable" interface

that has a "run()" method in it, by having a class that

is "Runnable" (implements Runnable) anyone using that class knows that it must have a "run()" method

defined. This is used when you have several

different classes that have the same interface. Interfaces have more in common with abstract

classes than they do with packages. An interface,

by definition, cannot have any implemented

methods; an abstract class, in contrast, can define

some methods and leave some methods to be

implemented by a subclass. Also, a class can implement many interfaces, but can only extend one

(abstract) class.

Answer by Sahe Alam Ansari, BCA. Nepal bhairahawa. email: mrsahealam@gmail.com

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

16y ago

A package is just a mechanism for grouping objects, it is very similar to grouping items within a folder or directory on a file system. A class is found within a package, but this does not have an impact on the class' behavior (review the "package" access level for a slight exception).

An interface, however, is a .java file that is used (implemented) by another class to tell the outside world that it conforms to a certain specification. For example, you might have a "Runnable" interface that has a "run()" method in it, by having a class that is "Runnable" (implements Runnable) anyone using that class knows that it must have a "run()" method defined. This is used when you have several different classes that have the same interface.

Interfaces have more in common with abstract classes than they do with packages. An interface, by definition, cannot have any implemented methods; an abstract class, in contrast, can define some methods and leave some methods to be implemented by a subclass. Also, a class can implement many interfaces, but can only extend one (abstract) class.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A package groups together a set of similar features, such as java.net (for networking) or java.security (for limiting user permissions). An API defines an entire suite of code that can be used to interface with a library or program, and may span multiple packages. In other words, a package is only for organization, while an API is what allows code units to cooperate with each other.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

They aren't similar from any aspect.

This answer is:
User Avatar
User Avatar

Harsh Mukati

Lvl 1
1y ago
wrost site ever i seen

User Avatar

Wiki User

12y ago

kai ni bhai....

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the Difference between header file and package?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between the header file and the preprocessor directive in programming language cpp?

pata nhn


What is the different between header file and header pointer?

Header file is a file which is meant to be included into another file during compilation. Examples: string.h, stdio.h, inttypes.h. Header pointer is a pointer to an object called header (for example header of a linked list).


What is the difference between program and programing?

the program contains the which are coding like as our header file ,void main,library function etc.


How do you include classes and structures in header files in c plus plus?

Classes and structures can be put in a header file the same way you would use them in a main program; the only difference is that they are placed in a separate file, called a header file. Then, after creating a new file, include that new file with the definition by the use of the preprocessor #include statement.


What is the difference between using angular brackets in C language and double quotes in Cpp language to enclose header files?

When you includes any header file using "" that time compiler try to locate this file first from your program's local directory and then from library. But if you include the .h file using <> then compiler assumes you are including some library file.


What is the header file of graphics?

The header file of graphics in TurboC is graphics.h


How do you create a user defined header file?

Header files are not much different from usual cpp files. There are basically two different things. It's file extension: you need to choose "header file" when you create it or save as .h file. Second is header files do not have main() function. When you are done with you header file do not forger to include it in your project by writing preprocessor directive:#include "your_header_file.h"


What is the use of header file stdbool.h?

stdbool header file use for a new data type that is boolean value


Which header file is FILE declared in?

The FILE type is declared in stdio.h.


If a file header is lost or corrupted and an application needs that header to read the file how can you recover the contents of the file?

Not possible. Always make backup copies.


How do you include a system header file called sysheader.h in a c source file?

There is no system header called share.h, but if there were, it would be: #include <share.h>


What is the difference between a form file object and a windows form object?

difference between a form file and a form.