class Foo {}
======>class Foo {
    Foo() {
        super();
    }
}
class Foo {
    Foo() {}
}
======>class Foo {
    Foo() {
        super();
    }
}
public class Foo {}
======>public class Foo {
    public Foo() {
        super();
    }
}
class Foo {
    Foo(String s) {}
}
======>class Foo {
    Foo(String s) {
        super();
    }
}
class Foo {
    Foo(String s) {
        super();
    }
}
======>Nothing, compiler doesn't need to insert anything.
class Foo {
    void Foo() {}
}
======>class Foo {
    void Foo() {}
    Foo() {
        super();
    }
}
(void Foo() is a method, not a constructor.)
Refrence: SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065)
No comments:
Post a Comment