219k views
5 votes
When a method returns an array reference, you include ____ with the return type in the method header.

a.
( )

b.
[ ]

c.
< >

d.
{ }

User Gagneet
by
5.9k points

1 Answer

2 votes

Answer:

b. []

Step-by-step explanation:

Arrays are represented using [] . When a method returns an array reference, the method header contains an entry of the type <data-type>[].

For example, a method test which returns a reference to integer array and takes no parameters is of the form:

int[] test();

Similarly a method list_chars which takes a String as an argument and returns an array of chars has the form:

char[] list_chars(String s);

User Ankii Rawat
by
6.8k points