Jump to content

Number Game of Death


Recommended Posts

Posted (edited)

If you dare to play save all your work first.

 

Run the following and report back the last number you see. Highest number wins. Mine was 50585.

public class NumberGameOfDeath {
    private static Object s = new Object();
    private static int count = 0;

    public static void main(String[] argv) {
        for (; ; ) {
            new Thread(new Runnable() {
                public void run() {
                    synchronized (s) {
                        count += 1;
                        System.err.println("New thread #" + count);
                    }
                    for (; ; ) {
                        try {
                            Thread.sleep(1000);
                        } catch (Exception e) {
                            System.err.println(e);
                        }
                    }
                }
            }).start();
        }
    }
}

If you don't know how to run it. Then go learn it bitch.

 

Take a picture of it if you can.

Edited by Th3
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...