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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -