I am struggling to understand the workflow when you have multiple Java files.
myNode.java:
package x;
class myNode {
private myNode next = null;
private int d;
myNode(int d) {
this.d = d;
}
void append(int d) {
myNode curr = this;
while (curr.next != null) {
curr = curr.next;
}
curr.next = new myNode(d);
}
}
myMain.java:
package x;
class myMain {
public static void main() {
myNode x = new myNode(1);
x.append(2);
}
}
I get the following error message when I try to compile myMain.java
error: cannot find symbol
myNode x = new myNode(1);
^
symbol: class myNode
location: class myMain