हिंदी

Java statement to access the 5th element of an array is:

Advertisements
Advertisements

प्रश्न

Java statement to access the 5th element of an array is:

विकल्प

  • X[4]

  • X[5]

  • X[3]

  • X[0]

MCQ
Advertisements

उत्तर

X[4]

Explanation:

In Java, array indexing starts from 0, so the 1st element is at index 0, the 2nd element is at index 1, and the 5th element is stored at index 4. Therefore, arrayName[4] is used to access the 5th element.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Arrays - One Dimension - Exercises [पृष्ठ १७४]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 7 Arrays - One Dimension
Exercises | Q 1. (xi) | पृष्ठ १७४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×