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).app
解決辦法1:this
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..spa
To resolve this issue please create instance of main class first:code
GeoLocation outer = new GeoLocation();
Then create instance of class you intended to call, as follows:blog
service.submit(outer.newThreadTask(i));
解決方法2:get
public static class ThreadTask implements Runnable { ... }