1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Introduction to Java

Connected

अभ्यास

How long is a String?

Text comes in all sizes - from single characters to entire paragraphs. Knowing how many characters a String contains is essential for validation, formatting, and processing text. Let's discover how Java helps you measure Strings!

निर्देश

100 XP
  • Use the .length() method to find out the length of the bookName variable, saving the result as bookNameLength.
  • Find the length of the author's name, "Terry Pratchett", and save it using the correct primitive type.