This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
If you need to use some of the predefined classes of the API in your class and extend the capabilities of the same class then you have to use import. With out importing a package or a class you cannot extend or inherit the properties and methods of a class.
Someone correct me if I am wrong
The greater danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it
I'm going to go out on a limb and say that I think he was asking what's the different between implements and extends, because they look similar
The difference is that you can extend one other class, and you can implement any number of interfaces. Extending a class means inheriting all its methods, and adding to them and possibly overriding some of them; implementing an interface means that you have to supply all the methods declared in the interface. In both cases, your class becomes a subtype of the class or interface, so that if a method asks for a SuperClass or SomeInterface instance, you can pass a Foo instance and it will work.
I am assuming that you asked difference between import and extends keyword .
extends keyword achieves use of inheritance in java.
purpose of inheritance - resuse of code from elsewhere(from class which might be in same package or else in different package)
1.if class is in same package:
a. all you need to do is simply use extends keyword to extend/inherit the class.
2.if class is in different package:
a.must import package in which the class is available using import keyword.
b.then extend the class using extends keyword.
1.you can import more than one packages in your class depending upon your requirement.
2.you must extend only one class as java does support multilevel inheritance ,does not support multiple inheritance(using implements keyword we can implement more than one interface.)