Module 3 (Interface) 4 and 5
Module 3 (Interface) 4 and 5
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.