Você está na página 1de 2

1. (a) Explain garbage collection and finalize method in JAVA.

(b) What is the difference between method overloading and method overriding?
(c) The abstract vegetable class has three subclasses named Potato, Brinjal and Tomato.
Write a java program, that demonstrates how to establish this class hierarchy. Declare
one instance variable of type String that indicates the color of a vegetable. Create and
display instances of these objects. Override the toString() method of object to return a
string with the name of vegetable and its color. (4+3+7)

2. (a) Explain the role of JVM.


(b) What is the difference between a local variable, a class variable and an instance
variable?
(c) Explain instanceof operator.
(d) Explain the use of „super‟ and „this‟ keyword. (4+3+3+4)

3. (a) How does Java garbage collector work?


(b) What is the object serialization in Java? Illustrate with an example.
(c) What is the difference between comparison done by equals method and == operator?
Explain it with a suitable example. (3+5+6)

4. (a) Describe the different stages in the life-cycle of an applet.


(b) Distinguish between init( ) and start( ) methods.
(c) Write a GUI program in Java that will have two buttons viz., RED and GREEN. If
user clicks on RED button the background of the GUI will be painted in red or if user
clicks on GREEN button the background of the GUI will be painted green. (5+2+7)
5. (a) Discuss different visibility modifiers.
(b) Explain the interface and its usage.
(c) Design a package that contains the class Worker and another package to contain the
interface Wages. Now write a program to display the details of worker along with their
wages by using the above mentioned package and interface. (4+3+7)

6. (a) State difference between String Class and StringBuffer Class.


(b) Write short notes on wrapper class.
(c) Write a java program to implements a Vector that accepts five items from the
command line and store them in a Vector and display the objects stored in a Vector. Now
perform (i) insertion of an item, (ii) deletion of a specific item and (iii) replacement of a
specific item.

7. (a) What is exception? How can you handle the exception in Java? Explain.
(b) What is user-defined exception? Explain with a suitable program.
(c) Explain the difference between „throw‟ and „throws‟ with a suitable example.
(d) What is the use of “finally” keyword? (4+4+3+3)

8. (a) What is multithreading?


(b) Explain the advantages of multithread programs.
(c) How to create a thread in Java?
(d) What is the need of synchronized block? Illustrate with an example.
(e) Can you set priorities in a thread? Explain. (2+3+3+4+2)

Você também pode gostar