About 348,000 results
Open links in new tab
  1. Initializing Arrays in Java - Baeldung

    Dec 16, 2024 · In this article, we explored different ways of initializing arrays in Java. Also, we learned how to declare and allocate memory to arrays of any type, including one-dimensional …

  2. How to Declare and Initialize an Array in Java - GeeksforGeeks

    Oct 11, 2025 · The array memory is allocated when you use the new keyword or assign values. Complete working Java example that demonstrates declaring, initializing, and accessing arrays

  3. How do I declare and initialize an array in Java? - Stack Overflow

    Jul 29, 2009 · You can either use array declaration or array literal (but only when you declare and affect the variable right away, array literals cannot be used for re-assigning an array).

  4. How to Initialize an Array in Java - JavaBeat

    Jun 25, 2025 · In Java, arrays let us keep/store multiple values of the same data type in one variable (instead of creating separate variables for each value). We can initialize the arrays …

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

  6. Java Arrays - W3Schools

    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 [ ] :

  7. How to Initialize All Elements of a Java Array to a Specific Value ...

    Nov 4, 2025 · This guide will walk you through every method to initialize Java arrays to a specific value, from manual loops to built-in utilities and modern Java 8+ features.

  8. How to Initialize an Array in Constructor in Java | Delft Stack

    Feb 2, 2024 · The Arrays.setAll() method empowers Java developers to initialize arrays within constructors with a dynamic, index-dependent approach. This method is particularly useful …

  9. Java Array Initialization: A Comprehensive Guide - javaspring.net

    Nov 12, 2025 · Initializing an array is a fundamental operation that every Java developer should master. This blog post will delve into the different ways to initialize arrays in Java, exploring …

  10. Java Defining and Initializing Arrays - DataCamp

    Learn how to define and initialize arrays in Java efficiently. This guide covers syntax, examples, and best practices for managing Java arrays effectively.