मराठी

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×