This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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).]
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.
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...
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).]