Question
Java allows you to have a List of List objects or Set of Set objects, but not a List or Set of Map objects. a) True b) False Being able to declare a List or a List is made possible by: a) Generic types b) Inheritance c) STL d) Plug-ins e) Embedding When an object is instantiated a) A class destructor is called b) Class methods (i.e., static methods) can then be used c) It can be extended d) Memory is allocated e) None of the above Which of the following is true? a) Classes can subclass only one parent class, but can implement many interfaces b) Classes can subclass many parent classes and implement many interfaces c) Classes can subclass many parent classes, but can implement only one interface d) All of the above e) None of the above One method M1 in class C1 overloads another method M2 when: a) Both are in the same class and M1 and has the same name, return type, and parameter types as M2 b) M2 is defined in a subclass of C1 and M2 and has the same name, return type, parameter types as M1 c) Both are in the same class and M1 and has the same name and return type as but different parameter types/order d) M2 is defined in a superclass of C1 and M2 and has the same name and return as M2, but different parameter types/order e) None of the above A public class method is one that a) Is available only to instances (objects) of classes in the same package b) Is available only to instances (objects) of that class c) Can only be called in the class constructor d) Can be called without instantiating the class e) None of these
Explanation / Answer
Answers
12) Option A - reasson, Java needs 3rd party api support like JASon array help such scenarios
13) Option A - Java 5 allows us to have generic types
14) Option D - When instantiated, the constructor is called and memory is allocated
15) Option A - Only one super class is possible at a level by extending.
16) Option C - The same name and difference in parameter list or return type means overloading. Same method signature results in overriding which is possible when in parent child relationship