129k views
4 votes
A String constructor cannot be passed ________.

a. char arrays.
b. int arrays.
c. byte arrays.
d. Strings.

1 Answer

2 votes

Final answer:

A String constructor in Java cannot be passed int arrays. Though constructors exist for char arrays, byte arrays, and Strings, int arrays require conversion before being used to construct a String.

Step-by-step explanation:

The student has asked which type of array cannot be passed to a String constructor. The answer is b. int arrays. The String constructor in Java can accept various types of parameters including char arrays, byte arrays, and Strings, but it does not have a constructor that directly accepts an int array. To create a String from an int array, one would need to convert the int values to their String representation or characters before using them to construct a String.

User Jack Skeletron
by
7.9k points