Swordfinger offer printListFromTailToHead prints the linked list from end to end

public class Solution {
ArrayList < Integer > arrayList=new ArrayList < Integer > ();

public ArrayList<Integer> printListFromTailToHead(ListNode listNode) {
    if(listNode!=null){ 
        this.printListFromTailToHead(listNode.next);
        arrayList.add(listNode.val); 
    } 
    return arrayList; 
}

doesn"t understand the meaning of this in the code, and arrayList.add (listNode.val); add a value that you don"t know about this node? Why is it the value an of the next node? Ask for the answer of the Great God

Mar.18,2021

this represents the current object, the printListFromTailToHead method is called to create the Solution object, and the this points to the Solution object, which is available or not in this code. The recursive code executes in the order of traversing to the last ListNode,ArrayList and then from the last ListNodeadd its val.
for example 7-> 8-> 9-> 10, traversing to 10, then 10add into list, and then add9, so printing the linked list from end to end.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38f00-34503.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38f00-34503.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?