java - How to Create Object of Interface? -


i have field interface

how create object of interface?

look under known implementing classes: customfield

this class looking for

field<t> myfield = new customfield<t>(string name, datatype<t> type); 

for list (array) of fields:

arraylist<field<t>> arr = new arraylist<field<t>>(); arr.add(myfield); 

if you're not familiar generics, t represents reference type (class) want use

for simple array type (not arraylist) be:

field<t>[] arr = new field<t>()[size]; arr[0] = myfield; 

consider using arraylist or other collection, there no reason use plain old array references variables in case.


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

tsql - Pivot with Temp Table (definition for column must include data type) -- SQL Server 2008 -