Aptitude (12) ASP.NET (2) Automata (4) Browser (1) C (5) C# (1) C++ (10) Code (3) CSS (1) Data Structure (1) DATABASE (3) HTML (1) java (43) JSP (1) math (1) MySql (8) other (6) php (3) Servlet (3)

Tuesday, 5 March 2013

Abstract



Abstract method: abstract method is a method which doesn’t  contains body in that class where it declares. Definitely It has a body in that class in which it becomes inherited .It may or may not has keyword  “abstract” when is declared in a interface but has keyword “abstract” when it becomes declared inside a abstract class .every  concrete class has a body( at least  empty body) of every abstract method to which concrete class keeping inherit
Abstract class:  every class which starts with “abstract” keyword and contained atleast one abstract method is known a abstract class it may has concrete method.  we   can’t  make instance of abstract class.
We can call constructor of abstract class using child class’s constructor since every constructor of class has  super() in its first line which calls the super class constructor.
Interface: interface is just like class but it it is created using interface keyword. Interface has all its method abstract by default and final field by default. Fields should be declared and initialized in same line.



  

No comments:

Post a Comment