About 226,000 results
Open links in new tab
  1. Java Arrays - W3Schools

    Java Arrays. Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value. To declare an array, define the variable type with square brackets:

  2. java - How to store arrays in single array - Stack Overflow

    To access a single element of the selected array you need to do something like: use the following syntax. Create array-of-arrays: There is no need to do so. You can use a two dimensional array for the job. Make sure the row length should be equal to the array with max length.

  3. java - How to store numbers in an array? - Stack Overflow

    May 1, 2015 · To store userinputs to int array you can do. array[i]=scanner.nextInt(); If you want to store number from 0 to 19 you can do. array[i]=i; public static void main(String[] args) { int array[] = new int[20]; for (int i = 1; i < array.length; i++){ array[i] = i; //To print all the elements in the array. for(int j=1; i< array.length; j++){

  4. Arrays in Java - GeeksforGeeks

    Mar 28, 2025 · Arrays in Java are one of the most fundamental data structures that allow us to store multiple values of the same type in a single variable. They are useful for storing and managing collections of data.

  5. Arrays in Java and how they are stored in memory

    Arrays in Java store one of two things: either primitive values (int, char, ...) or references (a.k.a pointers). So, new Integer[10] creates space for 10 Integer references only. It does not create 10 Integer objects (or even free space for 10 Integer objects).

  6. Java Array (With Examples) - Programiz

    In this tutorial, we will learn to work with Java arrays. We will learn to declare, initialize, and access array elements with the help of examples. An array is a collection of similar data types.

  7. Array in Java: store multiple values in a single variable

    Array in Java is used to store multiple values in a single variable consisting of the same data type and can be retrieved with its index.

  8. How to Initialize an Array in Java? - GeeksforGeeks

    Apr 14, 2025 · We first need to declare the size of an array because the size of the array is fixed in Java. In an array, we can store elements of different data types like integer, string, character, etc. In this article, we will discuss different ways to declare and initialize an array in Java.

  9. How to Store Values in an Array in Java - dummies

    After you’ve created an array in Java, follow this simple guide to put values into the array’s components.

  10. How to Create an Array in JavaArray Declaration Example

    Mar 16, 2023 · Java arrays can store elements of any data type, including primitive types such as int, double, and boolean, as well as object types such as String and Integer. Arrays can also be multi-dimensional, meaning that they can have multiple rows and columns.

Refresh