I am solving DFS problem so i used array of a ArrayList. Here is my code
ArrayList<Node> graph[] = new ArrayList[N+1];
         int u, v, w;
         for (int i = 1; i <=N; i++){
             graph[i] = new ArrayList<Node>();
       }
         for(int i=0;i<N-1;i++){
              u=sc.nextInt();
               v=sc.nextInt();
               w=sc.nextInt();
             graph[u].add(new Node(v,w));
             graph[v].add(new Node(u,w));
        }
System.out.println(graph[1].get(0));----------(1) 
For above print statement i got output Node@1db9742.I don't know why i am getting this out.
My input:   
1
3
1 2
1 3
2 3
Plz help me on how to print exact output from array of arrayList
Edit: Node class:
class Node {
    static int i;
    int distance;
    Node(int i, int distance) {
        this.i = i;
        this.distance = distance;
    }
}
 
     
     
    