2) Enlist any four compile time errors. 3) Define exception. State built-in exceptions. 4) Explain exception handling mechanism. w.r.t. try, catch, throw and finally. 5) Write the syntax of try-catch-finally blocks. 6) Define throws & finally statements with its syntax and example. 7) Write a program to input name and salary of employee and throw user defined exception if entered salary is negative. 8) What is exception? WAP to accept a password from the user and throw “Authentication Failure” exception if the password is incorrect. 9) Write a program to input name and balance of customer and throw an user defined exception if balance less than 1500.
10) Draw and explain life cycle of Thread.
11) Explain following terms: i) Thread priority ii) Types of Exception 12) What is thread? Draw thread life cycle diagram in Java. 13) Explain the two ways of creating threads in Java. 14) What is thread priority? Write default priority values and methods to change them. 15) Explain the concept of Deadlock in case of multithreading. 16) Explain different methods for inter thread communication. 17) Write a program to create two threads, one to print numbers in original order and other in reverse order from 1 to 10. 18) Write a program to create two threads. One thread will display the numbers from 1 to 50 (ascending order) and other thread will display numbers from 50 to 1 (descending order). 19) Write a Java program in which thread A will display the even numbers between 1 to50 and thread B will display the odd numbers between 1 to50. After 3 iterations thread A should go to sleep for 500 ms. 20) Write a java program to implement runnable interface with example.