Answers for "what is array"

1

what is array

1-ARRAY:
- It is fixed size.
- Ordered
-Allows Duplicates
-Can store Primitives and objects
-Can be multi-dimensional
-Build in data structure
Posted by: Guest on January-05-2021
3

What is Array?

• An array is a container object that holds a fixed number 
of values of a single type. The length of an array is established 
when the array is created. After creation, its length is fixed. 
You have seen an example of arrays already, in the main 
method of the "Hello World!" application.
This section discusses arrays in greater detail. 
• Each item in an array is called an element, 
and each element is accessed by its numerical index.

• Advantage of Java Array 
o Code Optimization: It makes the code optimized, 
we can retrieve or sort the data easily. 
o Random access: We can get any data located at any index position. 
• Disadvantage of Java Array 
o Size Limit: We can store only fixed size of elements in the array. 
It doesn't grow its size at runtime. To solve this 
problem, collection framework is used in java.
Posted by: Guest on May-16-2021
2

arrays

// Java program to demonstrate working of Arrays.toString() 
import java.io.*; 
import java.util.*; 

class GFG { 
	public static void main(String[] args) 
	{ 
		// Let us create different types of arrays and 
		// print their contents using Arrays.toString() 
		boolean[] boolArr = new boolean[] { true, true, false, true }; 
		byte[] byteArr = new byte[] { 10, 20, 30 }; 
		char[] charArr = new char[] { 'g', 'e', 'e', 'k', 's' }; 
		double[] dblArr = new double[] { 1, 2, 3, 4 }; 
		float[] floatArr = new float[] { 1, 2, 3, 4 }; 
		int[] intArr = new int[] { 1, 2, 3, 4 }; 
		long[] lomgArr = new long[] { 1, 2, 3, 4 }; 
		Object[] objArr = new Object[] { 1, 2, 3, 4 }; 
		short[] shortArr = new short[] { 1, 2, 3, 4 }; 

		System.out.println(Arrays.toString(boolArr)); 
		System.out.println(Arrays.toString(byteArr)); 
		System.out.println(Arrays.toString(charArr)); 
		System.out.println(Arrays.toString(dblArr)); 
		System.out.println(Arrays.toString(floatArr)); 
		System.out.println(Arrays.toString(intArr)); 
		System.out.println(Arrays.toString(lomgArr)); 
		System.out.println(Arrays.toString(objArr)); 
		System.out.println(Arrays.toString(shortArr)); 
	} 
}
Posted by: Guest on August-03-2020
8

What is Array?

// *** An array is a collection of data items, all of the same type,
 //     accessed using a common name

int main()
{
 
    // Creating an integer array named arr of size 10.
    int arr[10];
    // accessing element at 0 index and setting its value
    // to 5.
    arr[0] = 5;
    // access and print value at 0 index we get the output
    // as 5.
    printf("%d", arr[0]);
 
    return 0;
}
Posted by: Guest on June-21-2021
0

arrays

//Javascript Array
var fruitList = ["Bananas", "Apples", "Oranges"]
Posted by: Guest on October-02-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language