my dog learned polymorphism
The moose likes Beginning Java and the fly likes immutable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "immutable" Watch "immutable" New topic


eswar kumar
Ranch Hand

Joined: Oct 20, 2002
Posts: 98
what is immutable? what are the other immutable objects available in Java except string?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

An immutable object is one whose state cannot change; it represents a constant of some kind. java.lang.Integer, Long, Short, Character, Byte, Float, and Double are some of the other immutable classes in the JDK. There are others, and of course anyone can write an immutable class.

[Jess in Action][AskingGoodQuestions]
Zeeman Chen

Joined: Oct 30, 2003
Posts: 9
check this out

If a man take no thought at what is distant, he will find sorrow near at hand. ~ Confucius
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

... or this...
Steve Roderick

Joined: Mar 15, 2003
Posts: 5
My mate went for a job interview in java and they asked him how "they could change a string by passing it into a method". ANSWER they can't, or use a StringBuffer
[ November 27, 2003: Message edited by: Steve Roderick ]
I agree. Here's the link:
subject: immutable
It's not a secret anymore!