Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

JAVA PROGRAMS 2023-2026, Lab Reports of Java Programming

Java programs for the academic year 2024

Typology: Lab Reports

2024/2025

Uploaded on 02/26/2025

aishwarya-s-23-bca
aishwarya-s-23-bca 🇮🇳

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EX NO:
DATE:
MULTITHREADING WITH PRIORITIES
AIM:
To implement the concept of multithreading with the use of any
three multiplication tables and assign three different priorities to
them.
ALGORITHM:
Step 1: Start the process
Step 2: Define three thread classes A, B, and C, each implementing
run() method with different multiplication ranges and end messages.
Step 3: Set threadA to MAX_PRIORITY, threadB to
NORM_PRIORITY, and threadC to MIN_PRIORITY.
Step 4: Start threadA and wait for threadA to finish
Step 5: Start threadB,join Thread B and start Thread C, and join
Thread C
Step 6: Wait for threadB to finish, then start threadC and wait for it to
finish
Step 7: Handle any InterruptedException by printing an error message
and re-interrupting the current thread.
pf2

Partial preview of the text

Download JAVA PROGRAMS 2023-2026 and more Lab Reports Java Programming in PDF only on Docsity!

EX NO:

DATE:

MULTITHREADING WITH PRIORITIES

AIM:

To implement the concept of multithreading with the use of any three multiplication tables and assign three different priorities to them. ALGORITHM: Step 1: Start the process Step 2: Define three thread classes A, B, and C, each implementing run() method with different multiplication ranges and end messages. Step 3: Set threadA to MAX_PRIORITY, threadB to NORM_PRIORITY, and threadC to MIN_PRIORITY. Step 4: Start threadA and wait for threadA to finish Step 5: Start threadB,join Thread B and start Thread C, and join Thread C Step 6: Wait for threadB to finish, then start threadC and wait for it to finish Step 7: Handle any InterruptedException by printing an error message and re-interrupting the current thread.

EX NO:

DATE:

DRAWING SEVERAL SHAPES

AIM:

To draw several shapes in the created window. ALGORITHM: Step 1: Create ShapeDrawer class extending JPanel. Step 2: Implement paintComponent to draw shapes and text. Step 3: Draw a green circle, pink ellipse, magenta square, and blue rectangle with respective labels Step 4: Instantiate JFrame with title "Shape Drawer". Step 5: Create an instance of ShapeDrawer. Step 6: Configure JFrame to close on exit, set size, and add the ShapeDrawer panel. Step 7: Display the JFrame.