CodePudding user response:
Public static void main (String [] args) {Final String name="nanjing";
for (int i=0; I & lt; 10; I++) {
Final int j=I;
Ex. The execute (new Runnable () {
@ Override
Public void the run () {
JSONObject json=new JSONObject();
Json. The put (" name ", name);
Json. The put (" start ", j);
System.out.println(json);
}
});
}
}
Keep the Shared variables is a fixed value, multi-threaded Shared variables under the concurrency problem is a little more, be sure to do this, you can use the Shared variables and synchronization
CodePudding user response: