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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -