This is the process of converting a wrapper class object to a primitive type. A)
ID: 3843562 • Letter: T
Question
This is the process of converting a wrapper class object to a primitive type. A) simplifying B) unboxing C) parsing d) devaluating What does the following statement do? Float number = new Float(8, 8); A) It creates a Float object. B) It initializes that object to 8.8. C) It assigns the object's address to the number variable. D) All of the above To convert the double variable, d = 543.98, to a string, use the following statement: A) String str = Double.toString(d); B)String str = double.toString(d); C) String str = double(d); D)String str = d.Double.toString(str); Autoboxing is: A) Java's process of automatically "boxing up" a value inside an object B) The automatic allocation array elements C) The process of assigning a default value to primitive data types D) The process of identifying tokens in a string In an inheritance relationship: A) The superclass constructor always executes before the subclass constructor B) The subclass constructor always executes before the superclass constructor C) The constructor with the lowest overhead always executes first regardless of inheritance D) The unified constructor always executes first regardless of inheritance What key word can you use to call a superclass constructor explicitly? A) goto B) this C) super D) extends What is wrong with the following code? public class ClassB extends ClassA {public ClassB() {int init = 10; super(40);}} A) Nothing is wrong with the code. B) The method super is not defined. C) The all to the method super must be the first statement in the constructor.Explanation / Answer
32.
Autoboxing is conversion of primitive type to wrapper class and unboxing is the opposite way.
So, ANSWER IS (B) UNBOXING
-----
33. This creates a new object of type Float, then initializes it and then assigns it to the variable number.
So, all are correct.
ANSWER IS (D) ALL OF THE ABOVE.
-----
34.
According to java we can use Double.toString() for this.
So, answer is (A) String str = Double.toString(d);
-----
35. If we do something like the following:
Integer value = new Integer(10);
that means 10 will be automatically boxed up into the object.
So, answer is (A)
-----
36.
Correct answer is (A). The reason is that since the subclass is derived from superclass, the superclass constructor has to be executed first.
-----
37. super keyword can be used.
So, answer is (C) super.
-----
38. When the given code is ran, javac gives the following error:
ClassB.java:6: error: call to super must be first statement in constructor
So, answer is (C)
-----
If you have any queries, ask in the comments. If helpful, do give a thumbs up.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.