About 4,240,000 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. What are the default array values in Java? - Online Tutorials Library

    In Java arrays are the reference types which stores multiple elements of the same datatype. You can create an array just like an object using the new keyword − or, directly using the flower brackets ({}).

  3. Can we assume default array values in Java? for example, assume …

    The Java language guarantees that variables are initialized to a default value (false, 0, null, depending on the type). There's no need to manually initialize an array, it's just a waste of CPU cycles.

  4. Arrays in Java - GeeksforGeeks

    Mar 13, 2026 · An array is a collection of elements of the same data type stored in contiguous memory locations. It allows multiple values to be stored under a single name and accessed using an index. …

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

  6. How to Initialize an Array in Java? - Scaler Topics

    Sep 6, 2023 · The array initialization in java can be done in more than one way which is explained below: Initializing an Array Without Assigning Values how to initialize an array without assigning …

  7. Default Values Assigned to Primitive Data Types in Java

    Oct 1, 2024 · Now, here default values are values assigned by the compiler to the variables which are declared but not initialized or given a value. They are different according to the return type of data …

  8. Character Array in Java - GeeksforGeeks

    Jan 22, 2026 · A character array in Java is an array that stores multiple characters (char) in contiguous memory locations. It is useful when you want to manipulate individual characters of a string-like data …

  9. Set Default Value for Elements in List - Baeldung

    Jan 8, 2024 · In Java, when working with a List, sometimes, we may want to set a default value for elements in the list. For example, this can be useful when initializing a list. In this tutorial, we’ll …

  10. Different Ways To Declare And Initialize 2-D Array in Java

    Jul 23, 2025 · Note: We can use arr. length function to find the size of the rows (1st dimension), and arr [0].length function to find the size of the columns (2nd dimension). Declaring 2-D array in Java Any 2 …