Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Thanks A.jyotsna,
Can u tell me differnce between abstract class and interface

vikash

Answers were Sorted based on User's Feedback



Thanks A.jyotsna, Can u tell me differnce between abstract class and interface ..

Answer / sridhar

Abstact class can have both concrete and non-concrete
methods where as interface has only non-concrete methods.
Unlike interface, Abstract calss can contain fields that
are not static and final.

Is This Answer Correct ?    5 Yes 0 No

Thanks A.jyotsna, Can u tell me differnce between abstract class and interface ..

Answer / mohammad shoiab

Difference Between Abstract Classes and Interfaces
Abstraction - A way to provide a view to an object
In real life we have examples like resume,hotel menu,
trailer of a movie as examples for abstraction. They
provide an insight into the other object.
Abstract classes and Interfaces are implementation of
abstraction.
abstract class - when u want to create classification or
hierarchy of classes, u can use inheritance and generally
your parent classes would like to impose certain compulsory
behavior along with some free behaviours. in such a case
the compulsory behavior to be declared as abstract, there
by the class should also be declared as abstract, so the
right place for abstract class is only in the case of
inheritance.
Interface - Interface are more related to roles, like for
example, u r a kind of human, and u r playing the role of a
programmer, here human could be a abstract parent class
and programmer could be a interface.
In real life all roles carry compulsory behaviors and if
you want to get into some role, then it is compulsory to
implement all the methods of the role.
"The world is a stage, every one is a actor, every actor
carries a mask, and when the mask changes the role changes,
and when the role changes the behaviour changes"
The roles are interfaces - u know very well one person can
carry many roles, so one class can carry many interfaces
but it can belong to only one classification. Thats why
multiple inheritance is allowed for interfaces and not
allowed for abstract or concrete classes,

Happy!!! - want to know more fundas - contact me -
Shoiab - 9840135749 - Haaris Infotech - The Java Trainers -
Chennai

Is This Answer Correct ?    5 Yes 0 No

Thanks A.jyotsna, Can u tell me differnce between abstract class and interface ..

Answer / rakesh kumar jha

Abstract class:-
1. if we declare ny class as a abstract, then we can't
create an object/instace of that class explicitly.
2.afbstracts class may or may not contain abstract method.
3. if on declare any method as an abstract, then the class
should be declared as abstract.
4.if a method is declared as abstract in abstract class,
then child bound to define the abstract method of parent.
5.abstract class may contain constructor.
6.abstract class may hold the child object.
Interface class:-
1.by default all method be abstract.
2.class can implements more than one interface class.
3.child should give the body of all method of interface
class, but if a child class with abstract keyword, then nod
need to give the body of interface classes method.
4.interface can't create objects but can hold the object of
child.
5. variable in interface class are by default public,
static and final.
6.we can't use the final, static, native,synchronous
keyword with the methods define in interface.
7. we can't declare interface as final.


if any question have, tell me at rkjhaw@sify.com or
info@shandilya.org

Is This Answer Correct ?    1 Yes 0 No

Thanks A.jyotsna, Can u tell me differnce between abstract class and interface ..

Answer / jyotsna gupta

Abstract Class | Interfaces
|
1. Starts with a class keyword | Starts with interface
| keyword
2. abstract modifier has to be | No need to provide abstract
provided | modifier (100 % Abstract)
3. Not necessary to contain | All methods are by default
abstract methods, but if a | public and abstract, and
class has abstract method | all attributes are public
then class has 2 be abstract| static, and final (FIELDS)

4. Used for group of related | Any class can implement
classes only | interfaces

5. Single inheritance is | Multiple inheritance can
allowed only | be achieved

6. All class behaviours are | Cannot have constructors,
allowed, except creating | should initialise its
objects of abstract classes | Fields

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the Dictionary class?

1 Answers  


What is the file type?

0 Answers  


Which is the best sorting technique in java?

0 Answers  


how to java plateform independent?

5 Answers   TCS,


Howmany number of objects we can store in an ArrayList. Is there any limit?

7 Answers   TCS,


Is java developer a good career?

0 Answers  


What is use of a abstract variable?

0 Answers  


Is there memory leaks in java?

3 Answers  


What is java dot?

0 Answers  


how to deploy tomcatserver to weblogic server? write d following steps?

0 Answers  


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

0 Answers  


33. try { 34. // some code here 35. } catch (NullPointerException e1) { 36. System.out.print(”a”); 37. } catch (RuntimeException e2) { 38. System.out.print(”b”); 39. } finally { 40. System.out.print(”c”); 41. } What is the result if a NullPointerException occurs on line 34? 1 c 2 a 3 ab 4 ac

5 Answers  


Categories