class ThreadDemo2 {
  public static void main(String[] args) {
    Thread a = new Thread(new OutputRunnable('a'));
    Thread b = new Thread(new OutputRunnable('b'));
    a.start(); b.start();
  }
}

class OutputRunnable implements Runnable {
  private char c;
  
  OutputRunnable(char outputChar) {
    c = outputChar;
  }
  
  public void run() {
    for (int i=0; i<100; i++) {
      System.out.print(c); System.out.flush();
    }
  }
}
