Posted on Leave a comment

Java feature

  1. double brace
  2. ThreadLocal
  3. Instance Initializers

    [code language=”java”]
    public class Foo {
    public Foo() {
    System.out.println("constructor called");
    }

    static {
    System.out.println("static initializer called");
    }

    {
    System.out.println("instance initializer called");
    }
    }
    [/code]

  4. Enum – is a class
  5. try, finally, exception

    [code language=”java”]
    public static int f() {
    try {
    throw new RuntimeException();
    } finally {
    return 0;
    }
    }
    [/code]

  6. URL

    [code language=”java”]
    new URL("http://www.yahoo.com").equals(new URL("http://209.191.93.52"))
    [/code]

    =true

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.