What is the problem in this code ? Please help


#1
public class Solution {
    public ListNode swapPairs(ListNode A) {
        ListNode head = A;
        while(A!=null && A.next!=null){
            ListNode a = A.next.next;
            A.next.next = A;
            A.next = a;
            A = A.next;
        }
        return head;
    }
}