Advertisements
Advertisements
प्रश्न
Given:
int KH[] = {0, 0, 0, 0, 0, 0}
int len = KH.length;
system.out.print("array length="+len);
The output will be ______.
विकल्प
array length = 6
array length = 0
array length = 7
array length = 5
MCQ
रिक्त स्थान भरें
Advertisements
उत्तर
The output will be array length = 6.
Explanation:
- Counting Elements: The array variable
KHexplicitly contains six zero values enclosed within its curly brackets. - Length Property: The built-in
.lengthproperty in Java accurately counts the total number of allocated storage slots inside an array regardless of the values stored in them. - Final Print: The program prints out the text literal exactly as specified, displaying
array length=6on the console screens.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Arrays - One Dimension - Exercises [पृष्ठ १७३]
