I want to make an array of strings
I do not have a fixed size for it
As it must be initialized, I intialize it with null .. it give java null pointer exception ???
in another part of my code , I loop on the array to print its contents.. so how to get over this error without having a fixed size
public static String[] Suggest(String query, File file) throws FileNotFoundException
{
Scanner sc2 = new Scanner(file);
LongestCommonSubsequence obj = new LongestCommonSubsequence();
String result=null;
String matchedList[]=null;
int k=0;
while (sc2.hasNextLine())
{
Scanner s2 = new Scanner(sc2.nextLine());
while (s2.hasNext())
{
String s = s2.next();
//System.out.println(s);
result = obj.lcs(query, s);
if(!result.equals("no match"))
{matchedList[k].equals(result); k++;}
}
return matchedList;
}
return matchedList;
}