Westonci.ca is the Q&A platform that connects you with experts who provide accurate and detailed answers. Join our platform to connect with experts ready to provide precise answers to your questions in various areas. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.
Sagot :
In coding and programming, an array is a collection of items, or data, stored in contiguous memory locations, also known as database systems .
What is an array and example?
- An array is a collection of similar types of data. For example, if we want to store the names of 100 people then we can create an array of the string type that can store 100 names. String[] array = new String[100]; Here, the above array cannot store more than 100 names.
- An array is a linear data structure that collects elements of the same data type and stores them in contiguous and adjacent memory locations. Arrays work on an index system starting from 0 to (n-1), where n is the size of the array.
- Array in C can be defined as a method of clubbing multiple entities of similar type into a larger group. These entities or elements can be of int, float, char, or double data type or can be of user-defined data types too like structures.
- Arrays are used to implement data structures like a stack, queue, etc. Arrays are used for matrices and other mathematical implementations. Arrays are used in lookup tables in computers. Arrays can be used for CPU scheduling.
There are two types of arrays:
- One-Dimensional Arrays.
- Multi-Dimensional Arrays.
//importing package java.util.ArrayList to use ArrayList in the program
import java.util.ArrayList;
import java.util.Date;
public class test_array_list {
// Main method
public static void main(String[] args) {
// Create an array list of objects
ArrayList<Object> s = new ArrayList<Object>();
s.add(new Loan());
s.add(new Date());
s.add(new String("String class"));
s.add(new Circle());
// Display all the elements in the list by
// invoking the object’s to String() method
for (int element = 0; element < o.size(); element++) {
System.out.println((s.get(element)).toString());
}
}
}
To learn more about Array refer to:
https://brainly.com/question/28061186
#SPJ4
Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.