Java QuestionBankmodule2and3
Java QuestionBankmodule2and3
Demonstrate with an example, the concept of passing object as parameter and returning objects.
Write a program to illustrate instance variable hiding in JAVA
Illustrate JAVA access modifiers with examples.
How Garbage collection happens in JAVA?
Illustrate overloading of methods with a suitable program.
Illustrate overloading of constructors with a suitable program.
Describe two ways of argument passing with suitable examples.
Define recursion. Illustrate a recursive method with a suitable program.
Describe the following keywords with suitable examples:
i) final
ii) final with inheritance
Illustrate nested and inner classes with suitable examples.
Develop a JAVA program to create an outer class with a function display. Create another class inside
the outer class named inner with a function called display and call the two functions in the main class.
A class called Employee, which models an employee with an ID, name and salary, is designed as shown
in the following class diagram. The method raise Salary (percent) increases the salary by the given
percentage. Develop the Employee class and suitable main method for demonstration.
With example program, Explain Static data members and static member functions.
Explain the concept of inheritance and its classification.
Define inheritance. Explain multilevel hierarchy with an example program
When constructors are called in class hierarchy? Explain with an example.
Distinguish between method overloading and overriding in Java, with suitable example.
What is super? Explain the use of super with suitable example.
With an example, explain Dynamic method dispatch in Java.
Explain Local variable type inference and inheritance with example.
What is abstract class? Explain abstract class and abstract methods with suitable example.
What is an interface? Explain how an interface can be implemented with suitable example.
Briefly explain the role of interfaces while implementing multiple inheritance in java.
Write general form of interface. Explain how interfaces can be extended with an example.
Briefly explain Nested interfaces with example.
Explain how variables in interfaces are used. Give example.
With an example explain static, default and private interface methods in Java.
Develop a JAVA program to create an abstract class Shape with abstract methods calculateArea() and
calculatePerimeter(). Create subclasses Circle and Triangle that extend the Shape class and implement
the respective methods to calculate the area and perimeter of each shape..
Develop a Java program to create an interface Resizable with methods resizeWidth(int width) and
resizeHeight(int height) that allow an object to be resized. Create a class Rectangle that implements the
resizable interface and implement resizable methods