About 442,000 results
Open links in new tab
  1. java - How to find length of a string array? - Stack Overflow

    Feb 1, 2011 · Please initialise it with some value (s) and then you can use the length property correctly. For example: String[] str = { "plastic", "paper", "use", "throw" }; …

  2. length vs length() in Java - GeeksforGeeks

    Jan 4, 2025 · array.length: length is a final variable applicable for arrays. With the help of the length variable, we can obtain the size of the array. string.length () : length () method is a final …

  3. How to Find Length or Size of an Array in Java? - GeeksforGeeks

    Apr 18, 2025 · In this article, we will discuss multiple ways to find the length or size of an array in Java. In this article, we will learn: 1. Using the length Property (Best and Easiest Way) The …

  4. String Arrays in Java - GeeksforGeeks

    Nov 25, 2024 · In this article, we will learn the concepts of String Arrays in Java including declaration, initialization, iteration, searching, sorting, and converting a String Array to a single …

  5. Java String array: is there a size of method? - Stack Overflow

    May 28, 2009 · No length attribute for Strings. we have to use length () method. int [] s=new int [10]; System.out.println (s.length); //here we use length attribute of arrays.

  6. arrays - length and length () in Java - Stack Overflow

    Dec 27, 2009 · If I make an Array of length 4, that length of four is a defining characteristic of the Array, and is true regardless of what is held within. If I make a String that contains "dogs", that …

  7. Length vs length () in Java: Understanding the Crucial Difference

    3 days ago · Unlike arrays, strings in Java are full-fledged objects of the String class. The String class provides various methods to manipulate and get information about the string, including …

  8. Understanding Array Length vs String Length () in Java

    To get the length of an array, simply use the 'length' property, e.g., array.length. To find the length of a string, call the 'length ()' method on the string object, e.g., string.length (). Mistake: …

  9. .Length() Java: A Guide for Beginners to Experts

    Nov 6, 2023 · In Java, the .length property is primarily used to determine the size of arrays and strings. It’s a simple and straightforward way to know how many elements an array has or how …

  10. What is a Java String Array? - Guru Software

    Jan 16, 2025 · There are two common ways to declare a string array: 1. Without Size. This syntax declares a string array reference variable without allocating any memory to it. We would have …

Refresh