Multi Threading
© examsiri.com
Question : 28 of 44
Marks:
+1,
-0
Given:
Which of the following is a possible result? (Choose all that apply.)
public class Messager implements Runnable {
  public static void main(String[] args) {
   new Thread(new Messager("Wallace")).start();
   new Thread(new Messager("Gromit")).start();
  }
  private String name;
  public Messager(String name) { this.name = name; }
  public void run() {
   message(1); message(2);
  }
   private synchronized void message(int n) {
    System.out.print(name + "-" + n + " ");
   }
}Which of the following is a possible result? (Choose all that apply.)
Go to Question: