Compare and contrast vectors and arrays.

What will be an ideal response?


Vectors have many built in features that help track the number of elements as well as provide memory management capabilities. A corresponding array structure would require you to write much of your own code to accomplish the same tasks. The biggest advantage of vectors over arrays is the capability to increase and decrease size as necessary. Arrays have a fixed size.
Arrays do not carry the restrictions on base type that vectors impose. The base type of an array can be of any type; the base type of a Vector is always of type Object. Therefore, storing primitive values requires a little more work because the appropriate wrapper class needs to be used.

Computer Science & Information Technology

You might also like to view...

Method________sets a Thread object’s name.

a) name. b) threadName. c) setName. d) None of the above.

Computer Science & Information Technology

A GUI is being designed that will detect and respond to a mouse event. How many methods must appear in the listener object for the event?

a) 1 b) 2 c) 3 d) 4 e) 5

Computer Science & Information Technology

A __________ is an organized collection of data.

a) row b) database c) data reader d) primary key

Computer Science & Information Technology

The default workspace layout in Dreamweaver is ____.

A. Compact B. Expanded C. Programming D. Advanced

Computer Science & Information Technology