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

Java Question Bank Mid1

The document outlines important Java questions for a mid-term exam, covering topics such as constructors, access specifiers, JVM architecture, garbage collection, exception handling, threading, and collections. It includes definitions, distinctions, and programming tasks related to these concepts. Additionally, it provides examples and requires the implementation of various Java programs to demonstrate understanding of the topics discussed.

Uploaded by

jamijhansisiri
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)
2 views2 pages

Java Question Bank Mid1

The document outlines important Java questions for a mid-term exam, covering topics such as constructors, access specifiers, JVM architecture, garbage collection, exception handling, threading, and collections. It includes definitions, distinctions, and programming tasks related to these concepts. Additionally, it provides examples and requires the implementation of various Java programs to demonstrate understanding of the topics discussed.

Uploaded by

jamijhansisiri
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

JAVA IMPORTANT QUESTIONS(MID-1)

1. a. Define constructor, can we overload constructor?If so explain with an example.


b. Distinguish between interface and abstract class.

2. a. Explain access specifiers with example


b. What is dynamic binding? Explain with example
3. a. Explain JVM with a neat architecture and implement Java garbage collector.
b. Design an interface called Shape with methods draw () and getArea(). Further
design two classes called Circle and Rectangle that implements Shape to compute area
of respective shapes. Use appropriate getter and setter methods. Write a java program
for the same.
4. a. Explain Anonymous Inner class with examples.
b. Explain the following keywords with example- this, super, final, static.

5. a. When does an object become eligible for garbage collection? Write a program which
performs garbage collection.
b. Write steps involved to define a package? How to access, import a package? Explain
with example programs.

6. Construct a relation table for member access levels and visibilities.


UNIT-2
1. a. Draw and explain exception class hierarchy.
b. Define thread explain life cycle of thread.

2. a. What is a try-catch-finally block how it is used


b. Difference between multiple process and multiple threads.

3. a. What is error, exception, try, catch and final? Illustrate checked and unchecked
exceptions with exception hierarchy.
b. Write a program to handle user defined exception “insufficient funds in the
account”. The Exception is fired if the amount to withdraw is < the available balance.

4. [Link] life cycle of a thread with neat diagram. Write a java script to create a thread
by extending Thread class to display details of a thread like getId(), getName(), and
getPriority() .
b.A user has to create three threads. First thread displays Java in every four seconds,
the second thread displays DC in every two seconds, and the third thread displays OS
every three seconds. How to override run() by extending Thread class.

5. [Link] a Java program to handle the Exception using Try block and Multiple Catch
blocks. Write a program that includes a try block and a catch clause which processes
the Null Pointer Exception?
[Link] an example program to assign name to a Thread, getting name of the thread
and setting priority to a Thread.
6. [Link] Multi-threading concept in Java. Write a program showing multiple threads
working upon “join()”, “sleep()” functions.
[Link] do you classify the exceptions? Explain exceptions hierarchy.

7. [Link] we can use synchronized keyword in java? Explain with example. [Link] do
you place a try block within another try block for two different exceptions? Explain
with program.

8. How inter thread communication works. Explain with program.

UNIT-3
1. a. Explain the concept collection hierarchy.
b. Write a java program to create a list of elements and perform ascending and
descending order.

2. Write the difference b/w ArrayList, Stack and Vector classes with an example code.

You might also like