top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is the difference between Package and Inheritance in Java?

+2 votes
514 views
What is the difference between Package and Inheritance in Java?
posted Mar 16, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Packages are a namespacing system that also corresponds to the organisation of classes in the filesystem hierarchy.

An interface is a type that requires certain methods be defined. It is referred to either in the heading of a class (as in class C implements interface X) and anywhere a type reference is required, excepting that an interface is not a "concrete" class and cannot be instantiated directly (with new).

package foo.bar.thing; // where in the package namespace the name Baz will be defined

import zik.zot.OtherThing; // references a class or interface in another package

public class Baz implements SomeInterface {
    private List<OtherThing> things; // requires elements implement this interface
}
answer Mar 16, 2015 by Karthick.c
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...