Page 376 - CITS - Computer Software Application -TT
P. 376

COMPUTER SOFTWARE APPLICATION - CITS




           2.    Thread Synchronization
           Here, we will discuss only thread synchronization.
           Thread Synchronization
           There are two types of thread synchronization mutual exclusive and inter-thread communication.
           1  Mutual Exclusive

              1  Synchronized method.
              2  Synchronized block.
              3  Static synchronization.
           2  Co-operation (Inter-thread communication in java)
           Mutual Exclusive

           Mutual Exclusive helps keep threads from interfering with one another while sharing data. It can be achieved by
           using the following three ways:
           1  By Using Synchronized Method

           2  By Using Synchronized Block
           3  By Using Static Synchronization
           Exception Handling in Java
           •  Exception Handling
           •  Advantage of Exception Handling

           •  Hierarchy of Exception classes
           •  Types of Exception
           •  Exception Example
           •  Scenarios where an exception may occur

           The Exception Handling in Java is one of the powerful mechanism to handle the runtime errors so that the
           normal flow of the application can be maintained.
           In this tutorial, we will learn about Java exceptions, it’s types, and the difference between checked and unchecked
           exceptions.
           What is Exception in Java?
           Dictionary Meaning: Exception is an abnormal condition.
           In Java, an exception is an event that disrupts the normal flow of the program. It is an object which is thrown at
           runtime.
           What is Exception Handling?
           Exception Handling is a mechanism to handle runtime errors such as ClassNotFoundException, IOException,
           SQLException, RemoteException, etc.
           Advantage of Exception Handling
           The core advantage of exception handling is to maintain the normal flow of the application. An exception normally
           disrupts the normal flow of the application; that is why we need to handle exceptions. Let’s consider a scenario:
           1  statement 1;
           2  statement 2;
           3  statement 3;

           4  statement 4;
           5  statement 5;//exception occurs



                                                           363

 CITS : IT&ITES - Computer Software Application - Lesson 101 - 108  CITS : IT&ITES - Computer Software Application - Lesson 101 - 108
   371   372   373   374   375   376   377   378   379   380   381