aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 'JvalTest' Java2 Certification Mock Exam Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark " Watch " New topic
Author

'JvalTest' Java2 Certification Mock Exam Applet

sasank manohar
Ranch Hand

Joined: Feb 14, 2008
Posts: 186
This below question is from the website
http://valiveru.tripod.com/java/jvaltest.html
Question 49.
Which of the following java classes are immutable??

A.java.lang.Math
B.java.util.String
C.java.util.StringBuffer
D.java.lang.Boolean
E.java.lang.Object

Answer is B and D
My question is Why A is not correct.I thought Math class is also immutable.
One more question

Question 52.
If you want to create java GUI application using AWT, you constructed a frame calling
Frame f = new Frame();
What methods you need to call on the Frame f to make it visible.

A.f.setVisible(true);
B.f.setSize(true);
C.Both A & B
D.There is no need to call any methods on f explicitly to
make it visible.
Answer is c
I think setSize takes two parameters with width and height, here they have given boolean value parameter .
Can anyone please help with this.

[This message has been edited by sdev (edited July 18, 2000).]
[This message has been edited by sdev (edited July 18, 2000).]
[This message has been edited by sdev (edited July 18, 2000).]
[This message has been edited by sdev (edited July 18, 2000).]


"SCJP5 | SCWCD5| DEVELOPER"
sasank manohar
Ranch Hand

Joined: Feb 14, 2008
Posts: 186
Any takers please............
Khalid Bou-Rabee
Ranch Hand

Joined: Jul 12, 2000
Posts: 54
You're right on both accounts. Math is immutable because it is final, and setSize takes two int's as parameters.
Mock exams are never 100% correct.
Regards,
Khalid


\\ //<BR>~\// irucidal~
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Regarding the first question, if it means to ask which classes create immutable objects, then I'd have to say that the Math class doesn't fall into this category. You can't instantiate Math objects. I find that question to be rather ambiguous.
John Fairbairn
Ranch Hand

Joined: Jul 12, 2000
Posts: 31
DaB... that is an interesting point. At first glance at this question, I would say the Math class was immutable since it 'cannot be changed'.
We know that for strings a new string object is created when we try to change the string and the original string stays intact.
So i'm wondering do you have to be able to create an instance of a class for it to even be considered immutable? Since the math class is final maybe it can't be referred to as immutable...
rajsim
Ranch Hand

Joined: May 31, 2000
Posts: 116
B. java.util.String
Since when the String class moved to Java.util !?
A. java.lang.Math
Immutable classes do not permit change in the value of the object once it is created.
String is immutable as the value it contains can not be changed,
not that it is final.
But, instance variables of final classes can be changed at
any point in the program as per access rules.
Hence final classes do not necessarily mean immutable.
Now, As Math class doesn't contain any value, it may not be
termed as immutable or mutable
Please feel free to correct me.

[This message has been edited by rajsim (edited July 18, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 'JvalTest' Java2 Certification Mock Exam Applet