Which is the Best Java Web Framework ?

Java - Interview Questions and Answers on Abstract Classes and Interfaces

Q1.  Difference between Abstract and Concrete Class ?

Ans. Abstract classes are only meant to be sub classed and not meant to be instantiated whereas concrete classes are meant to be instantiated.

Q2.  What are Marker Interfaces ? Name few Java marker interfaces ?

Ans. These are the interfaces which have no declared methods.

Serializable and cloneable are marker interfaces.

Q3.  Is runnable a Marker interface ?

Ans. No , it has run method declared.

Q4.  Can we declare interface methods as private ?

Ans. No. 

Q5.  What is an Externalizable interface ?

Ans. Externalizable interface is used to write the state of an object into a byte stream in compressed format.

Q6.  Difference between serializable and externalizable interface ?

Ans. Serializable is a marker interface whereas externalizable  is not.

Q7.  Can we declare an abstract method private ?

Ans. No Abstract methods can only be declared protected or public.

Q8.  What are the design considerations while making a choice between using interface and abstract class ?

Ans. Keep it as a Abstract Class if its a "Is a" Relationsship and should do subset/all of the functionality. Keep it as Interface if its a "Should Do" relationship.

Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.