Hi,
I am learning java and am trying to understand some code that is written in Java 1.5, although I am more used to Java 1.4.2.
Could someone please convert this to java 1.4.2 or instead just tell me what is going on in the code?
thanks it is much appreciated
Code:
import java.util.*;
class Match {
private String sentence;
private List words = new ArrayList();
private Sentence sent
// some code removed...
// important part below... (in java 1.5)
public boolean checking(int c)
{
System.out.print("invoke the check(%d)\n", c);
if(c > (sentence.length()-1))
{
return true;
}
for (String s : words)
{
if(sentence.substring(c, sentence.length()).startsWith(s))
{
sent.addBoundary(c);
if(check(c+s.length()))
{
// System.out.printf("setting the boundary at %d\n", c);
return true;
}
sent.delBoundary();
}
}
return false;
}
(note:there is another class called sentence that also exist)