Skip to Content

Wednesday night puzzle

What’s the result of running this piece of code?

a) Done. b) InterruptedException is thrown c) It depends d) Code doesn’t compile

import java.util.Vector;

public class Main {
  interface A {

  static class AImpl implements A {
    static AImpl DUMMY = new BImpl();

  interface B extends A {

  static class BImpl extends AImpl implements B {

  public static void main(String[] args) throws InterruptedException {
    final Vector<Object> values = new Vector<Object>();

    Thread thread = new Thread() {
      public void run() {
    values.add(new BImpl());

comments powered by Disqus