Home  >  Article  >  Java  >  What is the difference between collections and arrays in java

What is the difference between collections and arrays in java

王林
王林forward
2020-08-20 17:08:482817browse

What is the difference between collections and arrays in java

The difference between collections and arrays:

(Recommended tutorial: java introductory tutorial)

1. Arrays are of fixed length of; a collection of variable length.

2. Arrays can store basic data types or reference data types; collections can only store reference data types.

(Learning video recommendation: java course)

3. The elements stored in the array must be of the same data type; the objects stored in the collection can be of different data types.

The above is the detailed content of What is the difference between collections and arrays in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete