It might be quite newbie question but i've been through my books and searched online; yet still didn't find any answers.

I have a couple of classes with methods in them.
In my main :

public class main 
{
	public static void main(String fileslist[])
	{
		new Folder();
		Search SearchFiles = new Search();
		SearchFiles.GetKey();
		SearchFiles.ReadSearch();
	}

}

I have named ReadSearch() :
AS :

public static void ReadSearch(String fileslist[])

In the main i have tried SearchFiles.ReadSearch(String fileslist[]);
which is actually the array it's dealing with, throughs an error.

Any ideas ?
Am i missing something really simple over here ?

You only need to pass in a reference to the String array object.

public class MyClass
{
   public static void readSearch(String[] filelist)
   {
      //Do stuff here
   }
}

public class OtherClass
{
   public void read()
   {
      String[] array = new String[2];
      array[0] = "Something";
      array[1] = "Other";
      
      MyClass.readSearch(array);
   }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.