We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Theory sheet 3
Note: You are advised to use only basic functionalities of JAVA (not build up libraries)
1. Discuss usefulness of super keyword with suitable example.
2. Can private constructor restrict the inheritance of class? Explain with example. 3. Can a blank final instant variable be initialized? Explain with example. 4. Suppose you levelled inheritance with five levels where B is inheriting class A, class C is inheriting class B, class D is inheriting class C and class E is inheriting class D. The method member of A is overridden by each inheriting classes. Answer the following: A. Discuss the possible ways an object of E will be able to access un- overridden member of class A. B. Discuss the possible members an object A = a new E() is able to access. 5. Discuss usefulness of final keyword with suitable example. 6. Discuss usefulness of object up-casting and down-casting with suitable example. 7. Suppose you levelled inheritance with five levels where B is inheriting abstract class A, abstract class C is inheriting class B, class D is inheriting abstract class C and class E is inheriting class D. The method member of A is overridden by each inheriting classes. Answer the following: A. Write down the correctness of this inheritance. In care it is correct answer part B and C. B. Discuss the possible ways an object of E will be able to access un- overridden member of class A. C. Discuss the possible ways an object A = a new E() 8. Can we use abstract-final, abstract-static, and abstract-private keywords combination in class? Explain each one with example. 9. Suppose you levelled inheritance with five levels where interface B is inheriting interface A, interface C is inheriting interface B, interface D is inheriting abstract interface C and class E is implementing interfaces A to D. Answer the following: A. Write down the usefulness of this inheritance. B. Can we use constructor chaining in creation of object E = a new E()? Explain with reasons. C. Can we use common member declared in each interfaces? Explain with reasons. 10.Suppose designer has designed multiple inheritance class dependency and you are required to implement it over Java platform. Discuss its implementation with suitable example. 11.Discuss the case where abstract class in inherit interface with example. 12. Suppose you have a class within another class. Answer the following: A. Discuss the purpose of nested class with suitable example. B. Discuss the different types of nested classes. C. Can we create an object of interface? Give examples in support of your answer. D. Can nested class have main (string [] args) method? If yes, discuss its usefulness. E. Discuss the case where interface is nested within class with suitable example.