Hi this is Salman.I am having a problem is linear search.The program doesnt compile giving the error "No method found matching linsearch".My code is

class search{
    public static void main(String args[]){
        int A[]=new int[1000];
        for(int i=0;i<A.length;i++){
            A[i]=(int) (1000*Math.random() +1);
       System.out.println(linSearch(799, A[i]));
        }
    }
}
class searching{
      public static int linSearch (int target, int [] list)
    {
    int location = -1, i = 0;
    boolean found = false;
    while (!found && i < list.length)
    {
        if (list [i] == target)
        found = true;
        else
        i++;
    }
    if (found)
    {
        location = i;
    }
    return location;
    } 
            }

Please tell me what to do :sad:

hi everyone,
You need to declare an instance of the class containing the function
like this

searching a = new searching();
System.out.println(a.linSearch(799, A));

Yours Sincerely

Richard West