I have a rather simple incomplete program involving nodes. I haven't gotten too far, but I'm having an issue. I've created a node and it's a string type. But when running the program, instead of printing the defined string, the output is the node name, followed by "@" and a bunch of letters and digits.
import java.util.Scanner;
public class Node {
public static void main (String[] args) {
Node x = new Node("ABCDEFG",null);
System.out.print(x);
}//void main
private String data;
private Node next;
public Node(String d, Node nx) {
data = d;
next = nx;
}
public String getData() {return data;}
public Node getNext() {return next;}
public void setData(String d) {data = d;}
public void setNext(Node n) {next = n;}
}// Node class
However the output is not shown as defined at the top, but looks like this:
Node@6d06d69c
Any possible solutions?