---
title: "What is the difference between the size and capacity of a Vector?"  
description: "What is the difference between the size and capacity of a Vector?"  
author: "Amit Singh"  
published: 2011-05-05  
updated: 2020-09-16  
canonical: https://www.mindstick.com/interview/832/what-is-the-difference-between-the-size-and-capacity-of-a-vector  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What is the difference between the size and capacity of a Vector?

The size is the number of elements actually stored in the vector, while capacity is the maximum number of elements it can store at a given instance of time.

## Answers

### Answer by Amit Singh

The size is the number of elements actually stored in the vector, while capacity is the maximum number of elements it can store at a given instance of time.


---

Original Source: https://www.mindstick.com/interview/832/what-is-the-difference-between-the-size-and-capacity-of-a-vector

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
