what is the difference between abstract class and
Interface?where we can use it in realtime projects?

Answer Posted / vishal srivastava

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. Says what a class should be | Says how a class must
like, behaves like a model | behaves and what it is
| able to do
5. Therefore, Generally given | Thus, given names as
class name as Nouns | Adjectives
6. Used for group of related | Any class can implement
classes only | interfaces
7. Single inheritance is | Multiple inheritance can
allowed only | be achieved
8. All class behaviours are | Cannot have constructors,
allowed, except creating | should initialise its
objects of abstract classes | Fields

Is This Answer Correct ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many wrapper classes are there in java?

541


what is use of functional interface in java 8?

564


What is numeric data type?

535


what is server side caching?

1614


What is the importance of static variable?

592






What is unmodifiable collection in java?

514


What does the append?

501


What is a for loop in java?

603


Write java program to reverse string without using api?

559


How will you add panel to a frame?

653


Is integer immutable in java?

552


What are the three best choices for a development environment?

618


Does sprintf allocate memory?

598


Define a java class.

811


What is the purpose of skeleton and stub?

590