About 81,500 results
Open links in new tab
  1. 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

  2. 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 and multi …

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

  5. Initializing an Array in Java: A Comprehensive Guide

    Nov 12, 2025 · This blog post will explore the various ways to initialize arrays in Java, including both one-dimensional and multi-dimensional arrays. Understanding array initialization is crucial for writing …

  6. How to Declare and Initialize an Array in Java: A Complete Step-by …

    Dec 3, 2025 · This guide will walk you through everything you need to know about declaring and initializing arrays in Java, from basic syntax to advanced use cases like multi-dimensional arrays.

  7. 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 using square …

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

  9. Arrays in Java - GeeksforGeeks

    Feb 17, 2026 · Memory for arrays is always allocated on the heap in Java. The elements in the array allocated by new will automatically be initialized to zero (for numeric types), false (for boolean) or null …

  10. How to Declare and Initialize an Array in Java - HowToDoInJava

    Learn to declare and initialize arrays using different techniques and their differences. Apart from directly accessing the arrays, we will also be using the java.util.Arrays and Stream API that provides several …