Although I've spent a lot of time looking through the short program below, I can't figure out what's causing the errors in lines 13 and 14.
Could you please give me some suggestions as to how I can figure out what is causing these errors? I believe that the error is something very simple and really what I want to learn is how to go about finding the cause of those errors, rather than a solution for this particular program.
The error message from Netbeans is as follows;
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - not a statement
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
While the text of the messages isn't much more informative than what you already saw, it's worth noting that they do provide a little ^ character which points to the approximate location in the line where the error occurred. Or at least, where the compiler thinks the error occurred. This isn't entirely reliable, since when the compiler doesn't understand what you're doing, its guess about what you are trying to do may be badly inaccurate. Still, the ^ can provide useful clues about what part of the line is the problem. In this case, the error at least points to the "int i++" part of the statement.
I don't know if NetBeans preserves the ^ part of the message that the compiler is giving you. If not, that's an extra reason to switch to another means for compiling and running your programs. Even using javac from the command line may give you more information. But maybe if you look closely, NetBeans might actually have some sort of visual indicator about which part of the line is the problem, the way eclipse and IntelliJ do.