About 556,000 results
Open links in new tab
  1. length vs length() in Java - GeeksforGeeks

    Jan 4, 2025 · The length() method returns the number of characters present in the string. length vs length() 1. The length variable is applicable to an array but not for string objects whereas …

  2. java - How to find length of a string array? - Stack Overflow

    Feb 1, 2011 · String[] str = { "plastic", "paper", "use", "throw" }; System.out.println("Length is:::" + str.length); The array 'str' is now defined, and so it's length also has a defined value.

  3. Java String length() Method - W3Schools

    The length() method returns the length of a specified string. Note: The length of an empty string is 0.

  4. 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(). Common Mistakes

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

    4 days ago · Historical precedent: Java‘s design was influenced by C and C++, where arrays also have a length property, while strings typically have length methods. Performance …

  6. Length vs. Length Method in Java | Interview Kickstart

    Dec 21, 2024 · In Java, the number of elements an array can hold, or the size of the array, is called its length. You can use this length attribute or variable to find the size of an array in …

  7. Java length vs length(): What's the difference? - TheServerSide

    Jun 9, 2022 · The key difference between Java’s length variable and Java’s length() method is that the Java length variable describes the size of an array, while Java’s length() method tells …

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

    length-- arrays (int[], double[], String[]) -- to know the length of the arrays. length()-- String related Object (String, StringBuilder, etc) -- to know the length of the String. size()-- Collection Object …

  9. Difference between Array Length vs String Length () Function in Java

    String.legth () is a function in Java that is used to know the length of String. It returns the number of characters that are stored in the String Variable. It returns the length of the String that is …

  10. 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: How to find the length of an array using the length property; …

Refresh