Question2:
I'm confused on ArrayList<Object>
, please explain to me the following:
I have a class Node
which has two fields: data1
and data2
public class Node {
private static int data1;
private static int data2;
public Node(){...}
public static void setData1(int data);
public static void getData1();
public static void setData2(int data);
public static void getData2();
} // end of class Node
And then I have another class called Link.
public class Link {
private ArrayList<Node> linkList = new ArrayList<Node>();
private Node node = new Node();
...
linkList.add(node)
linkList.get(how to do it here)
} // end of class Link
I want to output the Node
data inside linkList
.
linkList.get(how to do it here)
How would I do that?