Caller.java
ListNode n = new ListNode(5);
ListNode.java
class ListNode{
int val;
ListNode next;
public ListNode(int x){
val = x;
}
//METHOD
public void print(){
this.node = node;
//other
}
}
For every time I do something like
ListNode n = new ListNode(5);
n.print();
The print method inside ListNode.java
has a this
, which only refers to that new instance? (n
in this case)