I have a couple of classes in my app.
So in one of them i use same int to make my life easier on the other one
import java.util.*;
public class ObtainKey
{
public static void KeyAnalyzer()
{
int idx = 0;
int tokenCount;
String input;
String inputArr[] = new String [10];
System.out.println("Enter Search Key :");
Scanner getKey = new Scanner(System.in);
input = getKey.nextLine();
StringTokenizer st = new StringTokenizer(input);
tokenCount = st.countTokens();
while (st.hasMoreTokens())
{
inputArr[idx]=st.nextToken(); idx++;
}
int SearchWord = 0;
int Search2Words = 0;
int SearchAnd = 0;
int SearchOr = 0;
int SearchProx = 0;
int position = 0;
if (tokenCount == 0)
{
System.out.println("Please provide a searchKeyword");
}
if (tokenCount == 1) // search for 1 word
{
SearchWord = 1;
System.out.println("Looking for : " + inputArr[0]);
and if statements go on.
On my second class i would like to call these int again
import java.io.*;
import java.util.Scanner;
public class Search
{
public static void ScanSearch(String fileslist[])
{
try
{
for (int x=0; x<fileslist.length; x++)
{
//open file
FileInputStream fstream = new FileInputStream(fileslist[x]);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) !=null )
{
if(SearchWord = 0)
{
}
}
}
}
catch (Exception e)
{
System.err.println("Error: " + e.getMessage());
}
}
}
Error pops out while typing down the int's name.
Where am i wrong ?