Ernest, Thanks for your interest and help, but this situation just gets "curiouser and curiouser". 2 possibilities: I don't have my own String class. I tried switching to different versions JDKs - same results.
The reason I say "curiouser and curiouser" is that I can compile and run the program (which does a substring and prints it). The situation is that if I try to use any methods not in the drop down auto complete list, they are highlighted in red and IntelliJ complains that it doesn't know what it is, but these statements compile and run without error. It looks more and more to me like an IDE error.
Check your Module Settings dialog on the "Libraries" tab, Target JDK. If the Target JDK is printed in red, you're referencing a JDK that you may have uninstalled (thus it can't find the classes).
Although usually you get a lot of slop because java.lang.Object won't be defined either.
I don't know if it's available in IntelliJ 3, but in 5.0, hovering the mouse over "String" and pressing the Ctrl key will cause info to popup. If it doesn't say "java.lang.String" you know you've got a naming conflict.
Customer surveys are for companies who didn't pay proper attention to begin with.
I also checked my JDK settings for the project within IntelliJ and found no red markings. The JDK I am using has not been uninstalled. I used Explorer to check this out and everything required for a JDK installation is present.
I also checked several different JDK settings for JDKs which have been installed on my machine, and I got the same result for all of them.
author and iconoclast
And sure enough, the word "substring" lights up red, and the tooltip says "Cannot resolve symbol 'substring'." If I try to do autocompletion on abc., I do actually get the full list of String methods, though -- perhaps this is explainable by the version difference.
Anyway, yes, it's a bad error message, but this code is quite wrong: you can't put an expression like "abc.substring(0)" at class scope. It has to be inside a method, constructor, or initializer block.
So John, is this the problem?
Joined: Nov 02, 2000
No, that isn't the problem.
To be accurate, my problem is with the indexOf method of string and it lights up red every time (and its coded within a method).
But actually, looking at this code again precipitated an idea. You may have noticed that the method the indexOf is coded within is a action callback method and the app I am developing is a Swing app. I'm now guessing that somehow this is at the source of the problem although I don't know what to do to fix it.
author and iconoclast