Skip to content

Instantly share code, notes, and snippets.

@bric3
Created October 29, 2013 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bric3/7218689 to your computer and use it in GitHub Desktop.
Save bric3/7218689 to your computer and use it in GitHub Desktop.
Guess what could be printed on stdout !
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
public class URLPuzzler {
public static void main(String ... a) throws MalformedURLException, InterruptedException {
HashSet set = new HashSet();
set.add(new URL("http://google.com"));
System.out.println("containing `new URL(\"http://google.com\")` ? : " + set.contains(new URL("http://google.com")));
Thread.sleep(60000);
System.out.println("containing `new URL(\"http://google.com\")` ? : " + set.contains(new URL("http://google.com")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment