0% found this document useful (0 votes)
47 views

Java Programming Lab

This document outlines 14 exercises for a Java programming lab covering fundamental Java concepts like data types, control flow, classes, objects, inheritance, exceptions, threads, packages, applets and event handling. Some example problems include writing a program to find the roots of a quadratic equation, implementing single and multi-level inheritance, solving the producer-consumer problem using threads, and creating an analog clock or drawing shapes using applets. The exercises are meant to help students learn and practice core Java programming techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Java Programming Lab

This document outlines 14 exercises for a Java programming lab covering fundamental Java concepts like data types, control flow, classes, objects, inheritance, exceptions, threads, packages, applets and event handling. Some example problems include writing a program to find the roots of a quadratic equation, implementing single and multi-level inheritance, solving the producer-consumer problem using threads, and creating an analog clock or drawing shapes using applets. The exercises are meant to help students learn and practice core Java programming techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

d) Write a JAVA program using StringBuffer to delete, remove character.


Exercise - 3 (Class, Objects)

a) Write a JAVA program to implement class mechanism. Create a class, methods and invoke them
inside main method.

b) Write a JAVA program to implement constructor.


Exercise - 4 (Methods)

a) Write a JAVA program to implement constructor overloading.

b) Write a JAVA program implement method overloading.


Exercise - 5 (Inheritance)

a) Write a JAVA program to implement Single Inheritance

b) Write a JAVA program to implement multi level Inheritance

c) Write a java program for abstract class to find areas of different shapes
Exercise - 6 (Inheritance - Continued)

a) Write a JAVA program give example for “super” keyword.

b) Write a JAVA program to implement Interface. What kind of Inheritance can be achieved?
Exercise - 7 (Exception)

a) Write a JAVA program that describes exception handling mechanism

b) Write a JAVA program Illustrating Multiple catch clauses


Exercise – 8 (Runtime Polymorphism)

a) Write a JAVA program that implements Runtime polymorphism

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 for creation of Illustrating throw


b) Write a JAVA program for creation of Illustrating finally
c) Write a JAVA program for creation of Java Built-in Exceptions
d) d)Write a JAVA program for creation of User Defined Exception
Exercise – 10 (Threads)

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 ()

c) Write a Program illustrating Daemon Threads.


Exercise - 11 (Threads continuity)

a) Write a JAVA program Producer Consumer Problem

b) Write a case study on thread Synchronization after solving the above producer consumer problem
Exercise – 12 (Packages)

a) Write a JAVA program illustrate class path

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 to paint like paint brush in applet.

b) Write a JAVA program to display analog clock using Applet.


c) Write a JAVA program to create different shapes and fill colors using Applet.
Exercise - 14 (Event Handling)

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.

You might also like