Answer: method overriding : Questions « Object Oriented « SCJP






B.

Cannot reduce the visibility of the inherited method from Test1


it is less accessible than the original method








6.17.Questions
6.17.1.What is the output of the following program(inner class and outter class)?
6.17.2.Answer: inner class and outter class
6.17.3.The overriding and overridden methods must have the same name, argument list, and return type(True/False).
6.17.4.Answer: signature for overriding and overridden methods
6.17.5.The overriding method must not limit access more than the overridden method(True/False).
6.17.6.Answer: access control for overriding method
6.17.7.The overriding method must not throw any exceptions that may not be thrown by the overridden method(True/False).
6.17.8.Answer: exception and overriding method
6.17.9.The overriding method may not be private(True/False).
6.17.10.Answer: private accessor for overriding method
6.17.11.Local inner classes are not associated with an instance of an outer (enclosing) class(True/False).
6.17.12.Answer: inner class and outter class relation
6.17.13.Local inner classes may access final initialized variables and parameters that are in the scope(True/False).
6.17.14.Answer: inner class and final variable
6.17.15.Local inner classes may be declared public, protected, or private(True/False).
6.17.16.Answer: accessor for inner class
6.17.17.Local inner classes may not implement an interface(True/False).
6.17.18.Answer: interface and inner class
6.17.19.How is an instance of Outer accessed from within the scope of Inner?
6.17.20.Answer: pointer to outter class
6.17.21.What is the output of the following program?
6.17.22.Answer: inner class
6.17.23.Is the following code a legal method overloading?
6.17.24.Answer: method overloading
6.17.25.Is the following code a legal method overloading(naming)?
6.17.26.Answer: overloading and parameter
6.17.27.Is the following code a legal method overloading(exception throwing)?
6.17.28.Answer: method overloading and exception throwing
6.17.29.Is the following code a legal method overriding?
6.17.30.Answer: method overriding
6.17.31.Is the following code a legal method overriding(Exception and overriding)?
6.17.32.Answer: method overriding and exception throwing
6.17.33.What is the output(class inheritance)?
6.17.34.Answer: class inheritance
6.17.35.Which of the following are legitimate calls to construct instances of the Test class?
6.17.36.Answer: class inheritance and constructor
6.17.37.Define Base class to make the subclass legal
6.17.38.Answer: base class and subclass
6.17.39.Which variables can be referenced by System.out.println()?
6.17.40.Answer: variable scope and reference
6.17.41.Is it legal enums? enum Animals { LION, TIGER, BEAR }
6.17.42.Answer: how to define enum