About 48,400 results
Open links in new tab
  1. How to Declare and Initialize an Array in Java - GeeksforGeeks

    Oct 11, 2025 · To declare an array, specify the data type followed by square brackets [] and the array name. This only declares the reference variable. The array memory is allocated when you use the …

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

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

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

    Like declarations for variables of other types, an array declaration has two components: the array's type and the array's name. An array's type is written as type[], where type is the data type of the …

  6. How to Create an Array in JavaArray Declaration Example

    Mar 16, 2023 · To create an array in a single statement, you first declare the type of the array, followed by the name of the array, and then the values of the array enclosed in curly braces, separated by …

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

  8. Declaring Arrays in Java: A Comprehensive Guide - javaspring.net

    Nov 12, 2025 · This blog post will provide a detailed overview of declaring arrays in Java, including fundamental concepts, usage methods, common practices, and best practices.

  9. Java Array – Declare, Create & Initialize An Array In Java

    Apr 1, 2025 · This In-depth Tutorial Explains Various Ways to Declare, Create and Initialize a New Array With Values in Java with the Help of Simple Code Examples.

  10. Java - Arrays - Online Tutorials Library

    Declaring Array Variables To use an array in a program, you must declare a variable to reference the array, and you must specify the type of array the variable can reference.