Which of the following statements about Java arrays is true?

Java MCQ: Which of the following statements about Java arrays is true?

a) Arrays are of fixed size
b) Arrays can hold primitive types as well as objects
c) Array indices start at 0
d) All of the above

Answer:

d) All of the above

Explanation:

Java arrays have several key characteristics. They are of fixed size, meaning that once an array is created, its size cannot be changed. Arrays can hold elements of either primitive types (like int, char, etc.) or objects (like String, custom classes, etc.).

Array indices in Java start at 0, meaning that the first element of the array is accessed with index 0, the second element with index 1, and so on. This is a common convention in many programming languages.

Understanding how arrays work is fundamental for managing collections of data in Java, whether they are used for simple lists or more complex data structures.

Reference links:

https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top