What is the diff between interface and abstract class?why interfaces?why packages?why abstract class?what is the diff between uncheked exception,checked exceptions?why jvm works internally?why java does not support pointers?what is diff bet callby value and call by reference in java?

Showing Answers 1 - 8 of 8 Answers

Praveen Tangirala

  • Dec 13th, 2005
 

Interface is a class construct with methods having no functionality.Advantage of an Interface will come to the picture if the porgrammerwants to call the methods in such a manner where he/she can implementthose methods according their requirement/usage in a class construct.Abstraction is the process of getting the required by hiding unnecessary data objects.An Abstract Class can have the methods with/withoutfuncationality.By extending a normal class to the abstract class,the class will not become abstract.A method has to be defined as abstract in an abstract class elseit is a normal method.

  Was this answer useful?  Yes

prabhu

  • Dec 22nd, 2005
 

Abstract class extends to one class but interface can implement to many class.

  Was this answer useful?  Yes

Rajasheker

  • Jan 10th, 2006
 

 hai,

        Interface does not contain method implementation.If our class implements the interface we should follow those rules which are declared in interface.So who are writing interface they are giving the direction to who are going to implement those interface.

       But where as abtract class may or may not having method implementation.If our class is normal class is going to extend the abstract class we should implement all the abstract methods which are there in abstract class.If my class also abstract class it is going to extend the abstract class then we need not provide any implementation for the methods.i.e last concrete class should implement all the abstract methods.

       If abstract class and interface having same methods.Then we should go for interface is the best option Bcz we have another chance to extend the some other class.

  Was this answer useful?  Yes

Dinesh

  • Jan 12th, 2006
 

Abstract class are part of the Object Hierarchy where as interfaces are not.

  Was this answer useful?  Yes

Andy Liu

  • Jan 18th, 2006
 

Interface is Java's solution to multiple inheretance which allows a Java class to implement multiple interfaces at the same time.

  Was this answer useful?  Yes

Gajanan Bhat

  • Jan 30th, 2006
 

interfaces are like contracts that you say your class will follow...

abstract classes have more to do with inheritance and object hierarchy...you group together common functionality in a class...and implement some of the methods that you think will be common for most of the derived objects...rest of the methods will be abstract and will be implemented by the derived objects as they deem fit...

  Was this answer useful?  Yes

Anand

  • Apr 6th, 2006
 

Interface represents highest level of abstraction ie no declaration only definition of methods.

  Was this answer useful?  Yes

kamalagopinathan

  • Feb 14th, 2007
 

hai,Interface* Interface contain only method declaration* Interface implements more that onesAbstract* Abstract contain method declaration and definitions also* Abstract extend only one

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions