java - How to create an array of objects of a specific class type -
i have function returns object. object can contain array of primatives or array of objects. in c# can create empty array of objects or primatives using code like:
array values = array.createinstance(/*type*/type, /*int*/length);
is there equivalent in java?
how create array of objects of specific class type
test[] tests = new test[length] ;
and if want have mix of primitives , objects, though not suggestable, if want mix primitives objects
object[] objs = new object[length];
that allows both primitives(in form of wrappers
) , normal objects together.
if have class called test of own, can create array of test's
note until initialise elements in array, have null
value.
Comments
Post a Comment