2005-05-09から1日間の記事一覧

protected なコンストラクタは子クラスから単純な new ではアクセスできない

JLS2 6.6.2.2 より。でも、super() や無名クラス生成を通じてはアクセスできる。 package foo; public class ProtectedConstructor { protected ProtectedConstructor() { } }package bar; import foo.ProtectedConstructor; class ProtectedConstructorChil…

enclosingクラスと同じ名前の内部クラスは定義できない

JLS2 6.3 より。でもなぜ? class SameNameType { // コンパイルエラー class SameNameType { } void test() { // コンパイルエラー class SameNameType { } } }

メンバは同じ名前でもよい

JLS2 6.4.2 より。 class SameNameMembers { int hello; void hello() { } class hello { } }研修の合間を縫ってJava言語規格(JLS)を読んでみる。JavaVM規格は何回も読んだけどJLSを真面目に読むのは初めて。

マンガ・エロティクス・エフ

売ってないよ!