Java

Is an Object-Oriented Square a Rectangle?

I was in a course recently and someone said that it was wrong to have a class hierarchy where you had a base Rectangle class, and then you had a Square class that inherited from Rectangle.

Continue reading

Advertisements
Java

Collection Questions

Q: ArrayList v/s Vector

A: Vector and ArrayList both uses Array internally as data structure. They are dynamically resizable. Difference is in the way they are internally resized. By default, Vector doubles the size of its array when its size is increased. But, ArrayList increases by half of its size when its size is increased.

Continue reading