java - Is it necessary to resolve the errors shown in the output window of Netbeans IDE even if my code is working the way I want? -
say want 'of' typed in input user i making app, not finishing off in dumb output screen (this example) import java.util.*; scanner input = new scanner(system.in); string text = input.nextline(); int check = 0; for(int = 0; < text.length(); i++;){ if(text.substring(i, + 2) .equals("of")){ check = 0; } } if user enters abofd , surely recognises of @ position @ 2-4. when i value 4 checks position 4-6, position 6 not present not present gives error. know thinking me set i < text.length() - 1 @ line 5, original code needs run until end! it good idea validate input coming user, overcomplicating things! worse, wrote down outright wrong code: string text = input.nextline(); int check = 0; for(int = 0; < text.length(); i++;){ if(text.substring(i, + 2) .equals("of")){ the above can't work! see, i iterates 0 text length. using i+2 substring text. (so: hello first arrayindexoutofboundsexception). i...