Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
見積もり:
static final フィールドに変更可能な参照型がある場合、参照されるオブジェクトが不変であれば、定数フィールドになることができます。
これが何を意味するのかわかりません。誰かがその例を挙げることができますか?
不変のサブタイプを持つ可変型を持つことができます。
class Mutable {} // Not immutable, because it can be extended. final class Immutable extends Mutable {} // Reference type is mutable, but referenced object is immutable. static final Mutable CONSTANT = new Immutable();