Re: [algogeeks] Re: INTERFACES VS ABSTRACT
@all thanks On Thu, Aug 23, 2012 at 6:08 PM, vaibhav shukla wrote: > Abstract class are used for Abstraction > Interface are used for Polymorphism > > On Thu, Aug 23, 2012 at 6:06 PM, Amit Tiwari wrote: > >> With an abstract class, the subclass of that inheritance tree only can >> and should provide the definitions of the methods. With an interface, >> subclasses of different inheritance tree can also implement the same >> methods. Interface provides a way to separate out and group common behavior >> of different inheritance trees. It is kind of a substitute for the multiple >> inheritance that some other languages provide. >> >> On Thu, Aug 23, 2012 at 4:59 PM, kings wrote: >> >>> Dear sulekha, >>> >>> when u want a default property to get embedded ie u want to force any >>> feature use abstract. >>> when u want an additional feature need to be added used interface. >>> >>> ex: >>> For a car the default things are steering, engine, etc... if u want the >>> car to compulsory to have A/c then add it in the abstract >>> for a car having ABS is optional include it as an interface where ever u >>> think its necessary. >>> >>> >>> On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: >>> hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/qI3YhsGoh7wJ. >>> >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > best wishes!! > Vaibhav > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- sulekha metta B.E computer science osmania university -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: INTERFACES VS ABSTRACT
Abstract class are used for Abstraction Interface are used for Polymorphism On Thu, Aug 23, 2012 at 6:06 PM, Amit Tiwari wrote: > With an abstract class, the subclass of that inheritance tree only can and > should provide the definitions of the methods. With an interface, > subclasses of different inheritance tree can also implement the same > methods. Interface provides a way to separate out and group common behavior > of different inheritance trees. It is kind of a substitute for the multiple > inheritance that some other languages provide. > > On Thu, Aug 23, 2012 at 4:59 PM, kings wrote: > >> Dear sulekha, >> >> when u want a default property to get embedded ie u want to force any >> feature use abstract. >> when u want an additional feature need to be added used interface. >> >> ex: >> For a car the default things are steering, engine, etc... if u want the >> car to compulsory to have A/c then add it in the abstract >> for a car having ABS is optional include it as an interface where ever u >> think its necessary. >> >> >> On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: >> >>> >>> hi all, >>> why do we separately need interfaces in java?? we can declare all >>> the methods in abstract class as abstract this serves the purpose,then why >>> do we have interfaces??? >>> -- >>> sulekha metta >>> B.E computer science >>> osmania university >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/qI3YhsGoh7wJ. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- best wishes!! Vaibhav -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: INTERFACES VS ABSTRACT
With an abstract class, the subclass of that inheritance tree only can and should provide the definitions of the methods. With an interface, subclasses of different inheritance tree can also implement the same methods. Interface provides a way to separate out and group common behavior of different inheritance trees. It is kind of a substitute for the multiple inheritance that some other languages provide. On Thu, Aug 23, 2012 at 4:59 PM, kings wrote: > Dear sulekha, > > when u want a default property to get embedded ie u want to force any > feature use abstract. > when u want an additional feature need to be added used interface. > > ex: > For a car the default things are steering, engine, etc... if u want the > car to compulsory to have A/c then add it in the abstract > for a car having ABS is optional include it as an interface where ever u > think its necessary. > > > On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: > >> >> hi all, >> why do we separately need interfaces in java?? we can declare all >> the methods in abstract class as abstract this serves the purpose,then why >> do we have interfaces??? >> -- >> sulekha metta >> B.E computer science >> osmania university >> >> -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/qI3YhsGoh7wJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: INTERFACES VS ABSTRACT
Dear sulekha, when u want a default property to get embedded ie u want to force any feature use abstract. when u want an additional feature need to be added used interface. ex: For a car the default things are steering, engine, etc... if u want the car to compulsory to have A/c then add it in the abstract for a car having ABS is optional include it as an interface where ever u think its necessary. On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: > > > hi all, > why do we separately need interfaces in java?? we can declare all > the methods in abstract class as abstract this serves the purpose,then why > do we have interfaces??? > -- > sulekha metta > B.E computer science > osmania university > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/qI3YhsGoh7wJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: INTERFACES VS ABSTRACT
Java does not implement multiple inheritance. Interfaces are a way to have an Object having multiple behaviors. Abstract class won't give you that facility. Moreover, Interfaces should be used only to define types (Refer Effective Java by Josh Bloch for discussion on Abstract classes vs Interfaces) On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: > > > hi all, > why do we separately need interfaces in java?? we can declare all > the methods in abstract class as abstract this serves the purpose,then why > do we have interfaces??? > -- > sulekha metta > B.E computer science > osmania university > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/D52I5Y6cYTcJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.