Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Assignment-1
Java Programming lab
CSP-279
Submitted by : Submitted to :
CSE-8A
UNIT – 2 ASSIGNMENT-2(Set-6) JAVA PROGRAMMING (CST-254) 1. How do you share data between
two thread in Java? 2. What is the difference between notify( ) and notifyAll( ) in Java? 3. What is the
difference between the interrupted() and isInterrupted() method in Java? 4. Write code to solve
Producer Consumer problem in Java? 5. What class would you use to read a few pieces of data that
are at known positions near the end of a large file? 6. Why is Serialization required? What is the
need to Serialize? 7. Write a Program to demonstrate yield(),stop() and Sleep() method in java.
By using well-structured try, catch, and finally blocks, you can create programs
that fix exceptions and continue execution as if there were no errors. If there is a
possibility of more than one exception, you can use multiple catch blocks to
handle the different exceptions.
User-Defined Exceptions
Sometimes, the built-in exceptions in Java are not able to describe a certain
situation. In such cases, user can also create exceptions which are called ‘user-
defined Exceptions’.
ERRORS EXCEPTIONS
possible. caller.
Exceptions include both checked
Examples :
Exception, IO Exception