Collection framework
The Java collections framework standardizes the way in which groups of objects are handled by your programs.
int a=10;
We use variables and data types for storing data, but if you do likewise
int a=10;
a=20;
a=30;
System.out.println(a);
Output: 30
Because variables can hold one value at rime.
Int[20];
Arrays which is used to store number of elements in a same data type.
But it has some rules like
1. It can store same type of data.
2. It is linear data storage.
3. It need to be specify size before going to use the array.
4. If the value or data at runtime is large than the array size it will generate the Exception at Runtime.
So after analyzing the whole thing regarding data storage in a program Developers need one variable .
It has following features:
1. No need to specify the size
2. It can store a data in a format of object.
3. No need to specify type of data.
4. It internally manages the whole thing.
5. It follows Linear, no-linear data storage.
6. It avoids duplication of data and also supports duplication storage of data.
7. It can follow the data structure rules and regulation that is nothing but Collection.
Collection is Interface as well as a framework.
Framework???
It is nothing but predefined Infrastructure of java classes and interfaces.
Collection can collect a number of different objects.
Creating Program With Collection
Follow the below steps to write program to use all collection interface and classes.
Step-1 Create the Class “Allcolle.java”. Once you ready then write below code.
Output Allcolle.java