Welcome to Westonci.ca, the place where your questions find answers from a community of knowledgeable experts. Join our Q&A platform to get precise answers from experts in diverse fields and enhance your understanding. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
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 visiting our platform. We hope you found the answers you were looking for. Come back anytime you need more information. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Discover more at Westonci.ca. Return for the latest expert answers and updates on various topics.