File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Math 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 "Math" Watch "Math" New topic


Ranch Hand

Joined: Aug 03, 2000
Posts: 169
What about Math class???
Which of the following represent immutable classes?
a) String b) Double
c) StringBuffer d) Math
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
I would say yes, Math class is immutable.
All methods of Math class are static, so
I cannot have new behavior by overriding
it. Also, the constructor is private so
I cannot instantiate athe class.
- satya

Take a Minute, Donate an Hour, Change a Life
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
I think the term "immutable" is completely meaningless for the Math class. "Immutable" is used to refer to objects, to indicate that the instances of a class are unchangeable. With the Math class, it's not even possible to create any objects, so the term "immutable" doesn't really apply, in my opinion. I suppose you could answer this one either way - it's a vague question.

"I'm not back." - Bill Harding, Twister
Ranch Hand

Joined: Aug 17, 2000
Posts: 45
hi ...
u cant make a instance of maths class so there is no question of its immutebility ....
there should be some object on which we could immutebility ...
corrrrect me if i m wrong ......
manal ...
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

Well, the way I was thinking of immutable is that
"I cannot change the behavior of the class/obj"
With this thought in mind, I said yes. Sure it is
- satya
Karthik Subramanian

Joined: Aug 23, 2000
Posts: 27

Hi all,
I completely agree with the sheriff.When we can't even
create an object of a class how can we think of changing it's contents.String and Double classes are examples of immutable
Deepak M
Ranch Hand

Joined: Jul 10, 2000
Posts: 124
If we get this qt in the exam and we DON't select Math class as immutable, that would mean Math class is mutable.
However, thats not the case.
Therefore, I think its better off to choose Math class as immutable. Vague answer for a vague qt.
I agree. Here's the link:
subject: Math
It's not a secret anymore!