I am new to java and and trying to test/improve my program.
it works on my computer but not on the clients so I and trying to do error handling but am not sure about the syntax.
How do you put try/catch on for and do while loops as well as if statements. would it just go inside them like any other command ?
for(int eight = 0; eight < 8; eight++)
{
message = in.readLine();
LOGGER.fatal(eight);
LOGGER.fatal(message);
if(message.contains("Content-Length"))
{
message.getChars(16, 20, size, 0); THIS LINE
}
}
this is a an example of what I am using. how do I add a try/catch to the marked line.
Or do you have a better way to handle the exceptions ?