Help figureing out an compile error.
I'm working on some code that reads a paper and makes it so you can search for a set of letters or words. For example you could search for the word 'no' and it would find not only when 'no' is used but when 'know' is used. However I'm having trouble getting what I think might work to compile. It gives me:
Homework1.java:30: cannot find symbol
symbol : method length()
location: class char[]
if (current==test[tke] && tke!=test.length())
^
Homework1.java:36: cannot find symbol
symbol : method length()
location: class char[]
if (tke==test.length())
^
2 errors
I just need to figure out how to fix these errors. Knowing me this probably won't work if I fix these errors but still. Here is my code:
import java.util.*;
import java.io.*;
import java.text.*;
import java.lang.*;
publicclass Homework1
{
publicstaticvoid main(String[] args)
{
String line;
char current;
char[] test={'i','n','g'};
int num=0;
try
{
Scanner Reader =new Scanner(new File("assignment1Test1.txt"));
while(Reader.hasNext())
{
line=Reader.nextLine();
for (int ch=0; ch<line.length(); ch++)
{
current=line.charAt(ch);
int tke=0;
if (current==test[tke] && tke!= test.length())
{
tke=tke+1;
}
else
{
if (tke==test.length())
{
num=num+1;
}
tke=0;
}
}
}
}
catch (FileNotFoundException e)
{
System.out.println("I/O Error");
}
catch (NoSuchElementException e)
{
System.out.println("I/O Error");
}
}
}
P.S. If you feel like helping me out more than just helping me fix these two errors feel free.>

