0% found this document useful (0 votes)
3 views2 pages

Module 3 (Interface) 4 and 5

The document outlines various programming tasks and concepts in Java across three modules. Module 3 covers interfaces, inheritance, polymorphism, and class design, while Module 4 focuses on packages, exception handling, and access protection. Module 5 discusses threading, synchronization, and inter-thread communication, along with examples and program development for each topic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Module 3 (Interface) 4 and 5

The document outlines various programming tasks and concepts in Java across three modules. Module 3 covers interfaces, inheritance, polymorphism, and class design, while Module 4 focuses on packages, exception handling, and access protection. Module 5 discusses threading, synchronization, and inter-thread communication, along with examples and program development for each topic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Module 3

1. Explain how an interface is used to achieve multiple Inheritances in Java.


2. 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 implements the
resize methods.
3. Develop a JAVA program to create a class named shape. Create three sub classes
namely: circle, triangle and square, each class has two member functions named draw
() and erase (). Demonstrate polymorphism concepts by developing suitable methods,
defining member data and main program
4. Define interface in Java with suitable program example.

Module 4
1. Define package. Explain the steps involved in creating a user-defined package
with an example.
2. Write a program that contains one method that will throw an IllegalAccessException
and use proper exception handles so that the exception should be printed.
3. Define an exception. What are the key terms used in exception handling? Explain.
4. Explain the concept of importing packages in Java and provide an example
demonstrating the usage of the import statement.
5. How do you create your own exception class? Explain with a program.
6. Demonstrate the working of a nested try block with an example.
7. Build a Java program for a banking application to throw an exception where a person
tries to withdraw the amount even though he/she has lesser than the minimum balance
(Create a custom exception).
8. Build a Java program to create a package “Balance” containing Account class with
displayBalance() method and import this package in another program to access
method of Account class.
9. Examine the various levels of access protections available for packages and their
implications with suitable examples.
10. Explain below keywords with suitable programs.
a. finally b. throw c. throws

Module 5
1. What do you mean by a thread? Explain the different ways of creating threads.
2. What is the need of synchronization? Explain with an example how synchronization is
implemented in JAVA.
3. Discuss values() and value Of() methods in Enumerations with suitable examples.
4. What is multithreading? Write a program to create multiple threads in JAVA.
5. Explain with an example how inter-thread communication is implemented in JAVA.
6. Explain auto-boxing/unboxing in expressions.
7. Develop a Java program for automatic conversion of wrapper class type into
corresponding primitive type that demonstrates unboxing.
8. Summarize the type wrappers supported in Java.
9. Develop a program to create a class MyThread in this class a constructor, call the base
class constructor, using super and start the thread. The run method of the class starts
after this. It can be observed that both main thread and created child thread are
Executed concurrently.

You might also like