Java Programming Lab
Java Programming Lab
Exercise - 1 (Basics)
a) Write a JAVA program to display default value of all primitive data type of JAVA
b) Write a java program that display the roots of a quadratic equation ax 2+bx=0. Calculate the
discriminate D and basing on value of D, describe the nature of root.
c) Five Bikers Compete in a race such that they drive at a constant speed which may or may not be the
same as the other. To qualify the race, the speed of a racer must be more than the average speed of all 5
racers. Take as input the speed of each racer and print back the speed of qualifying racers.
Exercise - 2 (Operations, Expressions, Control-flow, Strings)
a) Write a JAVA program to search for an element in a given list of elements using binary search
mechanism.
b) Write a JAVA program to sort for an element in a given list of elements using bubble sort
c) Write a JAVA program to sort for an element in a given list of elements using merge sort.
a) Write a JAVA program to implement class mechanism. Create a class, methods and invoke them
inside main method.
c) Write a java program for abstract class to find areas of different shapes
Exercise - 6 (Inheritance - Continued)
b) Write a JAVA program to implement Interface. What kind of Inheritance can be achieved?
Exercise - 7 (Exception)
b) Write a Case study on run time polymorphism, inheritance that implements in above problem
Exercise – 9 (User defined Exception)
a) Write a JAVA program that creates threads by extending Thread class .First thread display “Good
Morning “every 1 sec, the second thread displays “Hello “every 2 seconds and the third display
“Welcome” every 3 seconds ,(Repeat the same by implementing Runnable)
b) Write a program illustrating isAlive and join ()
b) Write a case study on thread Synchronization after solving the above producer consumer problem
Exercise – 12 (Packages)
b) Write a case study on including in class path in your os environment of your package.
c) Write a JAVA program that import and use the defined your package in the previous Problem
Exercise - 13 (Applet)
a) Write a JAVA program that display the x and y position of the cursor movement using Mouse.
b) Write a JAVA program that identifies key-up key-down event user entering text in a Applet.