1.No enclosing instance of type GeoLocation is accessible. Must qualify the allocation with an enclosing instance of type GeoLocation (e.g. x.new A() where x is an instance of GeoLocation).
解决办法1:
This error happens because you're trying to create an instance of an inner class service.submit(new ThreadTask(i));
without creating instance of main class..
To resolve this issue please create instance of main class first:
GeoLocation outer = new GeoLocation();
Then create instance of class you intended to call, as follows:
service.submit(outer.newThreadTask(i));
解决方法2:
public static class ThreadTask implements Runnable { ... }