2 Oops
2 Oops
Write the syntax for importing packages in a java source file and give an
example.
6. What are the uses of streams? What are the two types of streams?
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
12. The following is a system that can be used to synchronize threads. In some
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
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
a) Uncaught exceptions.
15. Write a program to receive the name of a file within a text field and then
16. What are input and output streams? Explain them with illustrations.