I think they can be used to do the same things, Right ?

Is there anybody who can help me please ?

They have many similarities in how they are used, and a quick Google will find you lots of detailed discussion on the differences, but the shortest version is that abstract classes can contain far more than interfaces (eg actual method defininitions), but you can only extend one class at a time, while you can implement many interfaces.

An interface is more like a "template." It is the base for something. Like there could be an interface called Flyable. It would have methods for flying speed, how to fly etc. A duck would implement it. An abstract class would have some methods already built in like run. Every duck would run in the same way, right? Though it would also have some body-less methods. Note that an abstract class is a very basic duck and an interface is a template for a duck. The abstract class can then be overriden for advanced ducks.

abstract classes containing abstract and non-abstract methods.These are used to acheived polymorphism by overriding all the abstract method and essential non-abstract methods.Interfaces are the special class of the abstract classes.All the methods in Interface are must be abstract otherwise it will give COMPILE TIME ERROR.In case of Interfaces all the methods must be override.

An Interface is bound to contain abstract methods only whereas a Class CAN have concrete methods.
A Class CAN implement multiple Interfaces but CAN NOT extend multiple classes.
In an Interface all variables are static and final .But this need not be true in a Class.
The default access specifiers for the members of an Interface are public but it is not true for Classes.

An example where you will want to implement an Interface Runnable at the same time extending a Class Frame

class MyClass extends Frame implements Runnable{

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.