Do you know what a Class is? An actual Concrete Class that is used to create objects.
If you know about that, then an Abstract Class is a Class that is not Concrete, meaning it does not create objects. I has all the same features a normal (concrete) class has, but it has the keyword "abstract". In an abstract class, you are allowed to have methods that are not defined with the logic inside them; except just simply defined like: public void setName(String name);
Now for an Interface. You can only define the method and attributes (instance variables) like: public String name; public int age; public String getName(); and so on. Then you can implement an Interface and/or extend an Abstract Class.
See the good thing about Interfaces are, you can implement numerous ones. You can only extend one Class whether it is a Concrete Class or an Abstract Class.
However, if you implement an Interface, you must.... MUST define (use) every method within your Class that implements it/them.

Now if you need help explaining why you would use an Abstract Class or an Interface; well that is because of Inheritance, Abstraction and Polymorphism. First learn what those three things mean and then look into Abstract Classes and Interfaces.

What I have just told you here is the cut and dry of the meanings of both. But now you have a good understanding of the differences of them, so read more on these two and soon.... You will be a Coding Phenomenon   <-- I know this is Corny, but hey... You need excitement and a giggle here and there.

Stephen



nn roh wrote:
Hi all,

Thanks a lot for sharing ideas and help in this group :)

I want more examples on using abstract classes and interface ... ?

Thanks,

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to