Sie sind auf Seite 1von 1

JAVA PROGRAMMING - ASSIGNMENT - 4

PART-A

1) What is the importance of synchronization in java?


2) What is a daemon thread?
3) Differentiate between sleep () and wait ().
4) How to read data in java file? Discuss.
5) What happen when PrintWriter method receives a string type argument?

PART-B

1. a) What is thread synchronization? Discuss with an example.


b) Explain how communication between threads takes place with a programming example.
2. a) "Threads can be given priorities" - Support this statement with suitable example.
b) Explain various thread states and properties in detail with a neat diagram
3. a) What is a stream? What is the difference between byte streams and character streams? How are
they used to capture input from the user?
b) Differentiate between FileReader and BufferReader.

PROGRAMS:

1. Write a Java program that prints numbers from 1 to 10 line by line after every 5 seconds
2. Write a Java program to demonstrate multithreading operation.
3. Write a java program to implement producer consumer problem.
4. Write a java program to display all odd numbered lines of a text file.
5. Write a program to read user name from console and display some message for that user using
streams.

Das könnte Ihnen auch gefallen