Beruflich Dokumente
Kultur Dokumente
Answer:
a) True
b) False
2
Multiplie Answer:
a) It is ok even if no explicit constructor is defined in SuperClass
b) public SuperClass(int a, int b)
c) public SuperClass(int a)
d) public SuperClass()
e) only public SuperClass(int a) is required.
3
Answer:
a) It will print A, 4.
b) It will print A, A
c) It will print 0, 4
d) It will print 4, 4
e) None of the above.
4
Answer
a) In static, 1, In non - static, 2, In non - static :in that order.
b) Compilation error.
c) 1, In static, In non - static, 2, In non - static : in that order.
d) In static, 1, In non - static, 2, In non - static : in unknown order.
5
Multiple Answer:
Multiple Answer:
a) Make constructor private
b) Make member fields private and final and include public getters for them.
c) Make the class final.
d) Instead of a default no-args constructor, create a constructor that initializes the members.
e) Declare the members protected.
f) Declare members static.
g) Make the setters private.
7
8
Multiple Answer:
a) System.out.println(version);
b) System.out.println((Classic)version);
c) System.out.println(((Classic)this).version);
d) System.out.println(this.Classic.version);
e) System.out.println(MediaReader.version);
9
b) Option 1 would be correct only if the provided equals method is made public.
c) Two distinct Resource objects may be considered "not equal" even if their data
values are same.
d) The class will not compile because equals method is not correctly overridden.
a) 1
b) 2
c) 6
d) 7
e) None, because the program will not compile.
14
Multiple Answer:
a) An instance of the nested class can be created from any
class using: new TestOuter.TestInner().
(Assuming appropriate imports).
b) An instance of the nested class can be created only from
classes of package mypack.
c) An instance of the nested class can be created from a
class of package mypack using: new TestInner().
d) It will not compile.
15
Multiple Answer:
a) taxId
b) Name
c) criteria
d) Count
e) K
f) sum