Immutable objects

How to wrire a class which produces immutable objects

[60 byte] By [qazplma] at [2007-11-27 11:20:23]
# 1

> How to wrire a class which produces immutable objects

Homework assignment?

what does immutable mean to you? Removing what in Java makes an Object immutable?

_helloWorld_a at 2007-7-29 14:42:25 > top of Java-index,Java Essentials,Java Programming...
# 2

Don't expose any mutators. But I wouildn't just quote that directly in your homework because unless you understand what that means it'll be obvious you cheated

georgemca at 2007-7-29 14:42:25 > top of Java-index,Java Essentials,Java Programming...
# 3

> How to wrire a class which produces immutable objects

Assuming "wrire" means "write", here's a class that produces immutable objects.

public class ImmutableObjectFactory {

public Object produceImmutableObject() {

return new Object();

}

}

jverda at 2007-7-29 14:42:25 > top of Java-index,Java Essentials,Java Programming...
# 4

thanks for reply

qazplma at 2007-7-29 14:42:25 > top of Java-index,Java Essentials,Java Programming...