About 182,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. Arrays in Java - GeeksforGeeks

    Mar 28, 2025 · To declare an array in Java, use the following syntax: type [] arrayName; type: The data type of the array elements (e.g., int, String). arrayName: The name of the array. Note: The array is not yet initialized. 2. Create an Array. To create an array, you need to allocate memory for it using the new keyword:

  3. 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.

  4. How to Declare an Array in Java? - GeeksforGeeks

    Feb 28, 2025 · Declaration of an Array in Java is very straightforward. First, we need to specify the data type of the element, followed by square brackets [], and then we need to write the name of an array. Syntax: dataType [] arrayName; // preferred syntax. DataType: The type of elements the array will hold (e.g., int, double, String).

  5. How do I declare and initialize an array in Java?

    Jul 29, 2009 · For creating arrays of class Objects you can use the java.util.ArrayList. to define an array: public ArrayList<ClassName> arrayName; arrayName = new ArrayList<ClassName>(); Assign values to the array:

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

    Apr 14, 2025 · In this article, we will discuss different ways to declare and initialize an array in Java. Understanding how to declare an array in Java is very important. In Java, an array is declared by specifying its data type, and an identifier, and adding brackets [] …

  7. Arrays (The Java™ Tutorials > Learning the Java Language - Oracle

    Arrays are a powerful and useful concept used in programming. Java SE provides methods to perform some of the most common manipulations related to arrays.

  8. How to Create an Array in JavaArray Declaration Example

    Mar 16, 2023 · In this article, we will provide a step-by-step guide on how to create an array in Java, including how to initialize or create an array. We will also cover some advanced topics such as multi-dimensional arrays, array copying, and array sorting.

  9. Java arrays with Examples - CodeGym

    Apr 24, 2025 · Java has the java.util.Arrays class for working with arrays. In general, the most common operations performed on arrays are initialization (filling with elements), retrieving an element (by index), sorting, and searching.

  10. Java Array exercises: Array Exercises - w3resource

    Apr 1, 2025 · This resource features 395 Java Array Exercises, each complete with solutions and detailed explanations. Additionally, each exercise includes four related problems, providing a total of 79 problems for practice. [An editor is available at the bottom of the page to write and execute the scripts. Go to the editor] 1.

Refresh