I was trying to perform sorting of integers in an array and it worked fine. But when i try to modify the program by including a "pass by reference" concept via a method, it is throwing error "cannot find symbol".
I am new to JAVA and learning by my own, Please help me with what I am doing wrong here.
import java.util.*;
import java.io.*;
public class Sort {
    public static void main(String[] args) {
        Sort obj = new Sort();
        Scanner in = new Scanner(System.in);
        int i, p, k, arr[];
        arr = new int[10];
        System.out.println("Enter the numbers for sorting \n");
        for (i = 0; i < 5; i++) {
            arr[i] = in.nextInt();
        }
        for (i = 0; i < 5; i++) {
            for (p = 0; p < 5; p++) {
                if (arr[i] < arr[p]) {
                    /*
                     * moving the below block for swapping to a new method. k =
                     * arr[i]; arr[i]= arr[p]; arr[p]= k;
                     */
                    obj.swap(obj);
                }
            }
        }
        System.out.println("\n");
        for (i = 0; i < 5; i++)
            System.out.println(arr[i]);
    }
    public void swap(Sort m) {
        m.k = m.arr[i];
        m.arr[i] = m.arr[p];
        m.arr[p] = m.k;
    }
}
The error I am getting is :
"Sort.java:44: error: cannot find symbol
      m.k = m.arr[i];
       ^
"
Similarly 10 such errors for other variables as well.
 
     
    