why is this not working?
yea, I know I dont need that boolean finished in the beginning
You can throw
a RuntimeException inside your catch () {}
block as a workaround:
throw new RuntimeException("192.168." + i + '.' + j);
The line return null;
is the end of your getServerAdress()
function. There’s no way that the code after the return statement can be reached!
Each line of code is like a step in following a recipe. Essentially, what you’ve told the computer to do is to stop doing things, and then do something more. This confuses it. Did you want the function to stop at the return statement? Or did you want it to print “SERVER NOT FOUND” before it stops? You can’t have it both ways! That’s what your error means.
1 Like
oh i didnt think of that, thanks…