A small side note- Serializable is a marker interfaceIt doesn't have any method So a class implementing this- doesnt have to implement any method
On Sat, Feb 21, 2009 at 6:50 AM, Arkumik Raneas <[email protected]>wrote: > > okay, i'll try it my best;), and adding Mr. Sudhi and the others > explanation, actually extends & implementas have a quite similiarity > which is, their both can get a method as their elements, but the > different is when we use keywords extends, it's means that we inherit > a characteristics(a properties or a method) from actual super class, > and when we use implements statement it's means that you have to give > a body statement to an interface element(method) in the class that > implementing that interface. > > interface characteristis are that all method in it, are automatically > abstract method(that's why there is no body in it before the inteface > implemented). > > And what Mr. Sudi show us, is the best practice to use it;) when we > want to use interface & implements by ourselves we better use it to > distinguish between properties & method, which is one of design > pattern style(if i'm not wrong it's a strategic pattern) > > if you asking about Serializable it's in > http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html ,and > my explanation is if javabean use Serializable, that's means there is > a manndatory method in Serializable interface is required to invoke > javabeans. > > CMIIW > On Feb 20, 9:57 pm, Tanya Dina Ruttenberg <[email protected]> > wrote: > > Sudhi, > > Thank you for your *clear* example (and thanks to the others who replied > as well). Let's see if I get it right. > > When you extend a class, you add properties and methods to an existing > set of properties and methods > > When you implement an interface, you get access to the methods defined in > the interface. > > Is that basically it? BARKING presumable contains methods that describe > how to bark (verbs). > > Can you or someone please give an equally clear and concise explanation > of the following terms in a java context: > > 1) interface > > 2) serializable > > There was very skimpy explanation of the examples in this lab, and I > didn't understand the interface defined in MyEventsListenerInterface. What > was the point of it? And why does a javabean have to be "serializable"? > > Great class! I'm getting a lot out of it. > > Tanya > > -----Original Message----- > > From: [email protected] [mailto: > [email protected]] On Behalf Of sudhi > > Sent: Thursday, February 19, 2009 11:48 PM > > To: Free Java Programming Online Training Course By Sang Shin > > Subject: [java programming] Re: "extends" vs. "implements" LAB-1021 > > Dear Tanya > > To be very simple its just like > > public class ANIMALS > > { > > Has features like head, body as instance variables } > > public class DOG extends ANIMALS > > { > > has features of ANIMALS with some more features > > added to it like curved tail. > > } > > and it can be > > public class CAT extends ANIMALS implements Barking { } > > hope this is very very simple to understand > > Regards > > Sudhi > > > > -- -Rajiv www.rajivnarula.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
