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

2 Oops

Useful

Uploaded by

takash2412
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)
17 views2 pages

2 Oops

Useful

Uploaded by

takash2412
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

1.

Write the syntax for importing packages in a java source file and give an

example.

2. What is an interface and state its use?

3. What is object cloning?

4. What are the control flow statements in java?

5. What is class hierarchy? Give example

6. What are the uses of streams? What are the two types of streams?

7. Define Runtime Exception

8. What happens when the statement: int value =25/0; is executed?

9. What are the two useful methods to create directories?

10. Compare throw and throws?

11.Write a Java program to create a student examination database system

that prints the mark sheet of students. Input student name, marks in 6

subjects. This mark should be between 0 and 100. If the average of marks

is>= 80 then prints Grade̳ A‘ If the average of marks is< 80 and >=60 then

prints Grade̳ B‘ If the average of marks is< 60 and >=40 then prints

Grade̳ C‘ Else prints Grade̳ D

12. The following is a system that can be used to synchronize threads. In some

shops a machine issues numbered tickets to customers and served in

numeric order. A ticket machine holds an integer, initially zero, and has a

single atomic operation: turn() - which increments the integer and returns

its previous value. A scheduler also holds an integer, initially zero, and has

two atomic operations: next() - which increments the integer count

queue(value) - suspends the calling thread until the count is at least as


large as the value given as an argument Given a ticket machine, m, and a

scheduler , s, a critical region could then be coded as follows: number =

m.turn();s.queue(number); s.next(); Write Java classes TicketMachine,

with a turn method, and scheduler, with next and queue methods

13. Write an address book class that manages a collection of person object. An

address book will allow a person to add, delete, or search for a person

object in the address book. Add method : It should add a person object to

the address book. Delete method: It should remove the specified person

object from the book. Search method: It searches the address book for a

specified person and returns the list of persons matching the specified

criteria. The search can be done either by first name, last name or person

id

14. Write a short note on the following topics :

a) Uncaught exceptions.

b) Difference between throw and throws. Give example for both.

c) Chained exceptions. Give example

15. Write a program to receive the name of a file within a text field and then

displays its contents within a text area.

16. What are input and output streams? Explain them with illustrations.

You might also like