How do you declare arrays?

The following syntax is used to define the class and the initial expression of an array. Array size need not be defined in TSL.
b. class array_name [ ] [=init_expression]
c. The array class may be any of the classes used for variable declarations (auto, static, public, extern).

Showing Answers 1 - 1 of 1 Answers

shiva

  • May 26th, 2006
 

To declare arrays there are two options.

They are as follows: 1.Array of primitive & 2.Array of reference.

Array of primitive: int[] test= new int[3]

Array of reference: threads[] thread=new threads[5]

 we had mentioned the size of array on either declarations because JVM cannot allocate memory for objects of arrays until we give the size of an array.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions