aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes immutable objects vs classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "immutable objects vs classes" Watch "immutable objects vs classes" New topic
Author

immutable objects vs classes

Don Bosco
Ranch Hand

Joined: Oct 31, 2002
Posts: 108
Is there any difference between Immutable objects and classes?
according to my understanding from mock tests
Math is an immutable class.
objects of Double, Integer etc., are immutable objects.


SCJP 1.4<p>Wingardium Leviosa!!
chintan desai
Greenhorn

Joined: Oct 16, 2002
Posts: 10
Originally posted by Don Bosco:
Is there any difference between Immutable objects and classes?
according to my understanding from mock tests
Math is an immutable class.
objects of Double, Integer etc., are immutable objects.

According to my understanding Math Class is final class so it can not be subclassed or extended.
Objects of Doubl,Integer Etc. (Wrapper Classes) are immutable objects so their objects can not be changed.
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Is it possible to change the state of a class? I do not think so. Math is a utility class: uninstantiable and full of static useful methods.
A immutable class should produce immutable instances.


SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: immutable objects vs classes