हिंदी

Given that String hh = "Isaac Newton was a great scientist"; char pp = hh.charAt(7); What will be the value in pp?

Advertisements
Advertisements

प्रश्न

Given that

String hh = "Isaac Newton was a great scientist"; 

char pp = hh.charAt(7);

What will be the value in pp?

विकल्प

  • N

  • w

  • e

  • t

MCQ
Advertisements

उत्तर

e

Explanation:

The value in pp will be e. In Java, strings utilise zero-based indexing, which means character counting begins at zero rather than one. By counting sequentially from left to right across the string "Isaac Newton was a great scientist", index 0 corresponds to 'I', index 5 is the space character, index 6 holds the uppercase letter 'N', and index 7 lands directly on the lowercase letter e.

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

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×