27-10-2012, 04:42 PM
Packages and interface in Java
Packages and interface.pptx (Size: 73.89 KB / Downloads: 36)
INTRODUCTION
Packages are java’s way of grouping a variety
of class and interface together .
It act as containers for classes
ADVANTAGES
Two classes in two different packages can have the same name
Name space collision is minimized
packages helps in avoiding naming conflict
The classes contained in the packages of other programs can easily reused
Disadvantages
Updating any one of the function or producers will invalidate other object using different functions or procedures of the same packages as the whole packages is required to be compiled
we cannot pass parameter to packages
Creating a user defined packages
To create a packages just simply include a packages command as first statement in a java source file. Any classes declared within that file will belong to the specified packages .here is an example
Advantages
One can fully abstract a classes interface without implementation
Any number of classes can implement an interface
A class can implement any number of interface
Interface are mainly its own details ,with in a method
Disadvantages
Java interface are shower and more limited than other ones T he use of an interface which is not implemented more than one is just a waste of resource