I have created a piece of code which takes an IP address (from main method in another class) and then loops through a range of IP addresses pinging each one as it goes. I ha
Put some (final
) fields in your doPing
class, and a constructor that initializes them, then pass the values you want to use in call()
to the constructor of doPing
:
public class DoPing implements Callable<String> {
private final String ipToPing;
public DoPing(String ip) {
this.ipToPing = ip;
}
public String call() {
// use ipToPing
}
}