Why does the call: System.out.println(System.out): java.io.Printstream@7a84e4? produce a result such as 1) Because the implementor of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Why does the call: System.out.println(System.out): java.io.Printstream@7a84e4? produce a result such as 1) Because the implementor of the PrintStream class supplied a toString method 2) Because the implementor of the PrintStream class did not supply a toString method 3) Because the constructor of the PrintStream class did not get a toString method 4) Because the compiler of the PrintStream class did not supply a toString method If we mark fields in a class as protected, so that subclasses can access the fields directly what is a cause of concern? 1) Other classes in the same package can access the protected fields as if they were public breaking encapsulation. 2) Sub classes outside the package cannot access the protected super class fields 3) Protected fields cannot be manipulated by public methods While you are creating a class inheritance hierarchy about motor vehicles that will contain classes called Vehicle, Auto, and Motorcycle. Which of the following statements is correct? 1) Vehicle should be the default class, while Auto and Motorcycle should be the subclasses. 2) Vehicle should be the superclass, while Auto and Motorcycle should be the subclasses. 3) Vehicle should be the subclass, while Auto and Motorcycle should be the superclasses. 4) Vehicle should be the subclass, while Auto and Motorcycle should be the default classes. 5) All of the statements are correct. The reason why we cannot use this reference in a static method is because: 1) A static method does not have variables 2) A static method can be called when no objects of the class have been instantiated 3) A static method cannot be called when no objects of the class have been instantiated 4) All the answers are not correct Consider the above code snippet: Public abstract class Mansion{ } 1) This code snippet is just a template and can be instantiated into an object. 2) The above code snippet is not a template and can be instantiated into an object. 3) The above code snippet can be instantiated but your team has to extend it to a concrete class before. 4) The above code snippet can be instantiated but your team has to extend it to a concrete class after. Constructor chaining occurs when a call to a constructor is made from inside another constructor of a different class, and applies to overloaded constructors. True / False Final variables can be initialized when they are declared. If a class provides multiple constructors, everyone would be required to initialize each final variable. A final variable can be modified by assignment after it has been initialized. If a final variable is not initialized, a compilation error occurs. True / False If a local variable or parameter in a method has the same name as a field of the class, the field is hidden until the block terminates execution. This is called 1) Scope 2) Shadowing 3) Chaining 4) Boxing The most general entity in an inheritance hierarchy is a class called_ 1) Default class 2) Superclass 3) Subclass 4) Inheritance class The rule that allows a subclass object to be used when a superclass object is expected is known as 1) Subclass principle 2) Substitution principle 3) Extension Principle 4) None of the above answers are correct Why does the call: System.out.println(System.out): java.io.Printstream@7a84e4? produce a result such as 1) Because the implementor of the PrintStream class supplied a toString method 2) Because the implementor of the PrintStream class did not supply a toString method 3) Because the constructor of the PrintStream class did not get a toString method 4) Because the compiler of the PrintStream class did not supply a toString method If we mark fields in a class as protected, so that subclasses can access the fields directly what is a cause of concern? 1) Other classes in the same package can access the protected fields as if they were public breaking encapsulation. 2) Sub classes outside the package cannot access the protected super class fields 3) Protected fields cannot be manipulated by public methods While you are creating a class inheritance hierarchy about motor vehicles that will contain classes called Vehicle, Auto, and Motorcycle. Which of the following statements is correct? 1) Vehicle should be the default class, while Auto and Motorcycle should be the subclasses. 2) Vehicle should be the superclass, while Auto and Motorcycle should be the subclasses. 3) Vehicle should be the subclass, while Auto and Motorcycle should be the superclasses. 4) Vehicle should be the subclass, while Auto and Motorcycle should be the default classes. 5) All of the statements are correct. The reason why we cannot use this reference in a static method is because: 1) A static method does not have variables 2) A static method can be called when no objects of the class have been instantiated 3) A static method cannot be called when no objects of the class have been instantiated 4) All the answers are not correct Consider the above code snippet: Public abstract class Mansion{ } 1) This code snippet is just a template and can be instantiated into an object. 2) The above code snippet is not a template and can be instantiated into an object. 3) The above code snippet can be instantiated but your team has to extend it to a concrete class before. 4) The above code snippet can be instantiated but your team has to extend it to a concrete class after. Constructor chaining occurs when a call to a constructor is made from inside another constructor of a different class, and applies to overloaded constructors. True / False Final variables can be initialized when they are declared. If a class provides multiple constructors, everyone would be required to initialize each final variable. A final variable can be modified by assignment after it has been initialized. If a final variable is not initialized, a compilation error occurs. True / False If a local variable or parameter in a method has the same name as a field of the class, the field is hidden until the block terminates execution. This is called 1) Scope 2) Shadowing 3) Chaining 4) Boxing The most general entity in an inheritance hierarchy is a class called_ 1) Default class 2) Superclass 3) Subclass 4) Inheritance class The rule that allows a subclass object to be used when a superclass object is expected is known as 1) Subclass principle 2) Substitution principle 3) Extension Principle 4) None of the above answers are correct
Expert Answer:
Answer rating: 100% (QA)
question 1 The correct answer is Because the implementor of the PrintStream class did not supply a toString method When you call SystemoutprintlnSyste... View the full answer
Related Book For
Intermediate accounting
ISBN: 978-0077647094
7th edition
Authors: J. David Spiceland, James Sepe, Mark Nelson
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Carl contributes equipment with a $50,000 adjusted basis and an $80,000 FMV to Cook Corporation for 50 of its 100 shares of stock. His son, Carl Jr., contributes $20,000 cash for the remaining 50...
-
The risk-free rate, KRF, is 6 percent and the market risk premium, (KM - KRF), is 5 percent. Assume that required returns are based on the CAPM. Your $1 million portfolio consists of $700,000...
-
Hasselback Company acquired a plant asset at the beginning of Year 1. The asset has an estimated service life of 5 years. An employee has prepared depreciation schedules for this asset using three...
-
Wire 1 is \(2.3 \mathrm{~m}\) long and carries a current of \(2.2 \mathrm{~A}\) to the right. Wire 2 is also \(2.3 \mathrm{~m}\) long, and it carries a current of 3. 0 A to the left. The wires are...
-
For each of the following situations, identify the correct factor to use from Tables 1 or 2 in the appendix on present value table. Also, compute the appropriate present value. 1. Annual net cash...
-
Mr. Mutwiri opened a business in Meru town at the beginning of the year. During the first month of operation the following transactions were completed. 2014. January 1 Deposited sh 20,000 in the bank...
-
Baldwin Golf Supply produces a golf bag that sells for $200. Although the company's production capacity is 5,000 bags per year, currently only 4,000 bags are produced and sold. Production costs for...
-
A 4.10 kg block is pushed along a floor by a constant applied force that is horizontal and has a magnitude of 41.0 N. The figure gives the block's speed v versus time t as the block moves along an x...
-
A 0.276-kg volleyball approaches a player horizontally with a speed of 15.2 m/s. The player strikes the ball with her fist and causes the ball to move in the opposite direction with a speed of 21.4...
-
A 0.034-kg bullet is fired vertically at 208 m/s into a 0.15-kg baseball that is initially at rest. How high does the combined bullet and baseball rise after the collision, assuming the bullet embeds...
-
One barn, a unit used for cross sections in nuclear and particle physics, is equal to 1 0 ^ 2 8 1 0 - 2 8 square meters, about the cross - sectional area of a uranium nucleus. Assuming an atom is...
-
A 42.0-kg girl is standing on a 134-kg plank. The plank, originally at rest, is free to slide on a frozen lake, which is a flat, frictionless surface. The girl begins to walk along the plank at a...
-
Rainey Enterprises loaned 520,000 to Smail Co. on June 1, 2018, for one year at 8 percent interest. Required a. Record these general journal entries for Rainey Enterprises: (If no entry is required...
-
Find a polar equation for the curve represented by the given Cartesian equation. 4y 2 = x
-
On January 1, 2013, Cook Textiles leased a building with two acres of land from Peck Development. The lease is for 10 years. No purchase option exists and the property will revert to Peck at the end...
-
Assume Estate Construction is constructing a building for CyberB, an online retailing company. Under the construction agreement, if for some reason Estate could not complete construction, CyberB...
-
On October 1, 2013, Farmer Fabrication issued stock options for 100,000 shares to a division manager. The options have an estimated fair value of $6 each. To provide additional incentive for...
-
The bar graph illustrated in Figure 27 is a USA Today-type graph. A survey was conducted by Impulse Research for Quilted Northern Confidential in which individuals were asked how they would flush a...
-
Soccer continues to grow in popularity as a sport in the United States. High-profile players such as Hope Solo and Landon Donovan have helped generate renewed interest in the sport at various age...
-
Figure 30 represents the educational attainment (level of education) in 2013 of adults 25 years and older who are U.S. residents. Why might this graph be considered misrepresentative. Approach Find...
Study smarter with the SolutionInn App