Notes

  • 9
  • Locked
Asynchronous execution of threads. 1. The Note class will be used by threads. 2. Create a public static NoteThread thread (the Runnable interface does not make a class a thread), whose run method does the following 1000 times (index = 0-999): 2.1. Using the addNote method, add a note named [getName(
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Paul
Level 24 , Vienna, Austria
17 August 2022, 17:10
My obersavation from this task is: It only works if the addNode and removeNode get the name string from the getName() method. e.g. Note.removeNote(getName()); If you call Thread.currentThread().getName() or this.getName() instead, it doen't work. I really don't get that, because I thought, if called in the run method they should all return the same String
Adrian
Level 27 , Spanish Town, Jamaica
31 July 2020, 05:42
It was very interesting to me that you can assign a removed element to a variable in one line. when an object is removed from an arraylist, it still exists, and won't be garbage collected as long as a reference to it exists.