Here is what I want to do: In the loop, if the program finds an error, it will print out "Nothing" and go to the next loop (skips print out ""Service discovered at port: " + px + "\n"
for(int px=PORT1; px <=PORT2; px++) { //search
try{
Socket s = new Socket(IPaddress,px);
} catch(Exception e) {
System.out.print("Nothing\n");
// I want to go to next iteration
}
System.out.print("Service discovered at port: " + px + "\n");
}
What code should I put in the catch? "break" or "next" or ??? (This is java)