arraylist - How to defind the relationship between classes in java? -
more specific question: //there're 2 classes , b:
class { public static list<b> b = new arraylist<b>(); } class b { }
in schema, want object b class b. under circumstances,object b involve at least two objects "a_x" , "a_y" class a. how can create such relationship?
first thing,this public static list<b> b = new list<b>();
wont compile.
you might need public static list<b> b = new arraylist<b>();
you cannot instantiate interface.so provide concreate implementation.ex:arraylist
and second thing,you should add them directly ever creating list
.
Comments
Post a Comment