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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -