हिंदी

Given that: m = "reason".length(); What will be the value of m?

Advertisements
Advertisements

प्रश्न

Given that:

m = "reason".length();

What will be the value of m?

विकल्प

  • 66

  • 5

  • 4

  • 3

MCQ
Advertisements

उत्तर

6

Explanation:

The length() method in Java counts the total number of characters present in a given string, including letters, spaces, and punctuation symbols. Since the word reason contains exactly six letters (r-e-a-s-o-n), the method returns 6, which is then assigned to the integer variable m.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: String Handling - Exercises [पृष्ठ २४५]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 10 String Handling
Exercises | Q 1. (i) | पृष्ठ २४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×