-1

私は Java の初心者ですが、ネイティブのタイプセーフな列挙型パターンについて学びたいですか? 誰でも私を助けることができますか?

前もって感謝します..

4

2 に答える 2

1

を使用enumします。詳細は JLS を参照してください。

于 2012-10-22T10:15:36.017 に答える
0

i want to know the difference between typesafe enum patterns and native type-safe enum patterns.

A type-safe enum pattern is a design / implementation pattern that provides something similar to native enums. Since, Java 5.0 and later support native enum types (tutorial link), there is no real need to know how to do this. Just use native enum types.

If you are curious about how it used to be done, read this: Alternative to enum in Java 1.4

(A native typesafe enum pattern is a contradiction in terms. Java's native enum construct is a first class programming language construct ... not a design pattern.)

于 2012-10-22T10:35:43.490 に答える