I am attempting to implement a very simple Trie in Java that supports 3 operations. I\'d like it to have an insert method, a has method (ie is a certain word in the trie),
Your has function should probably look like this:
if (c[val]!=null && word.length()>1) {
return c[val].has(word.substring(1)); //<-- Change is on this line
} else if (c[val].flag==true && word.length()==1) {
...etc
You perform the recursive call, but you really need to let that value propagate back out to the original caller.