Posted in Core Java, Data Structure

Feature Comparison of some data structues

  ArrayList Array List Vector LinkedList HashTable HashMap Set Map
Unlimited size ×            
Index based            
Allow Nulls       ×    
Synchronized ×       ×    
Allow duplicate             ×  
Ordered data               ×
Advertisements
Posted in Core Java

Java – Abstract class vs Interface

 

Abstract class

Interface

Have abstract & non-abstract methods Only abstract methods
Not support multiple inheritance Supports multiple inheritance
Can have final/non-final/statis/non-static variables Only final & static variables
Can have:

·         static methods

·         main method

·         constructor

Cannot have

 

 

 

Can provide implementation of interface Cannot provide implementation of abstract class
When we want to add new methods When we want to have multiple inheritance
We extend it We implement it