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 A few questions! 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 "A few questions!" Watch "A few questions!" New topic

A few questions!


Joined: Oct 15, 2000
Posts: 1
1.public class Final
private int val = 0;

void set (int i) { val = i; }

static public void main(String a[])
final Final anObj = new Final();
anObj.val = 10;

Final bObj = new Final();
anObj = bObj;
If a class is final class, could the value of the class be changed?
So if the anObj.val = 10 is correct or not.
2.what difference between floor(-0) and floor(-0.0)?
why the result is different?
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
Hi laura,
final class
the only restriction with final class is thatit can't be subclassed.u can always change the values of it's members.
so the anObj.val = 10 is correct.

I don't have the answer to your second ques. right now. will try to find it out.
Manish Joshi

Joined: Oct 16, 2000
Posts: 16
As per the question posted Your class status is not final only the name of the class is Final the concept final is lowercsed (Keyword) In your case the class is normal class with the name as Final Where as further what you have done is You made reference to that object of your class you are making final which results into that Now your reference (Better known in jaava is handle ) to he object cannot change his reference to any other object thats it Contents of the handle is final whereas the Object is still mutable
Manish - India
I agree. Here's the link:
subject: A few questions!
jQuery in Action, 3rd edition