0

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 ?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by cale.macdonald
0

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);
   }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.