Caller.java使用 「這」 指類實例
ListNode n = new ListNode(5);
ListNode.java
class ListNode{
int val;
ListNode next;
public ListNode(int x){
val = x;
}
//方法
public void print(){
this.node = node;
//other
}
}
對於每一次我做點像
ListNode n = new ListNode(5);
n.print();
ListNode.java
裏面的打印方法有一個this
,它只是指新的實例? (n
在這種情況下)
YES YES YES YES –
[ 「本」 在Java中使用關鍵字]的可能的複製(http://stackoverflow.com/questions/577575/using-the-keyword-this-in -java) – John3136