GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Placement Papers  >  HP (Hewlett-Packard)  >  Technical

 Print  |  
Question:  What are interfaces, abstract classes. What is their purpose and differences ?



August 08, 2005 10:38:10 #2
 Binod   Member Since: Visitor    Total Comments: N/A 

RE: What are interfaces, abstract classes. What is their purpose and differences ?
 
Interfaces: 
We can define only methods, no implementation. 
All methods are abastract. 
We can define variables, but those shld be constants. 
 
Abstract classes 
Class which conatains one or more abstarct menthods or class which is marked as abstarct. 
We can have implementation inside this class. 
This class in meant to be extended by some other class, subclasses will provide implementation for abastarct methods. 
 
Interfaces are a way of implemention multiple inheretence in java. 
 
Choice of usage depends on design decision.
     

 

Back To Question