‎2008 Jul 10 10:44 AM
Hi every one, I'm a new abaper. Can anyone explain me what is interface and what is class, and, what's the difference between them? Thanks!!
‎2008 Jul 10 10:50 AM
HI
well here it is
interface is the place where data get excahnged
also interface do not have any code in it.
it have the defiantion of method and defined import export parementers
its the class which impliments the interface .
means which write the code as per the defination for that interface and pass the impoert ex[pot partameter
Chees
Snehi
‎2008 Jul 10 10:47 AM
Hi,
Basic difference is , A class can have a object but interface cannot have.
Thanks,
Sriram Ponna.
‎2008 Jul 10 10:48 AM
‎2008 Jul 10 10:50 AM
HI
well here it is
interface is the place where data get excahnged
also interface do not have any code in it.
it have the defiantion of method and defined import export parementers
its the class which impliments the interface .
means which write the code as per the defination for that interface and pass the impoert ex[pot partameter
Chees
Snehi
‎2008 Jul 10 11:05 AM
Hi,
In another words,
Interface is just a common place where we store some methods and events ( without logic )
This interface can be included in classes.The methods and events are derived to that class from interface then. The logic should be written inside methods of class.
In addition,
In Inheritance you can see single parent class can have multiple child classes but not vice versa.
So to have the facility of this kind of inheritance the concept of Interface arrives.
‎2008 Jul 10 11:01 AM
Hi Wuyia,
Classes have Implementation whereas Interfaces do not. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.
i) Interfaces enable multiple inheritances to the object.
ii)Interfaces contain only the definitions for the members without implementation.
Regards,
Sai
‎2008 Jul 10 11:07 AM
Hi Wuyia nata,
What is an Interface?
A Java keyword used to define a collection of method definitions and constant values. It can later be implemented by classes that define this interface with the "implements" keyword.
What is a class?
A class definition defines instance and class variables and methods, as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass will implicitly be Object.
For further information and the process of implementing you please refer these links. You will having some clear picture.
http://java.sun.com/docs/books/tutorial/java/concepts/class.html
http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
http://java.sun.com/docs/books/tutorial/java/IandI/createinterface.html
http://www.geekinterview.com/question_details/22958
Cheers,
Swamy Kunche