You are on page 1of 3

Experiment 2.

Student Name: SANA SACHDEVA UID: 20BCA1658


Branch: BCA Section/Group: BCA5/B
Semester: 4 th
Date of Performance: 09/04/22
Subject Name: INTERNET PROGRAMMING LAB
Subject Code: 20CAP-255

1. Aim/Overview of the practical:

Show the code and the output of the given program.

2. Task to be done:
Write a program to show the use of multitasking in different ways.

3. Code for experiment/practical:


4. classMultithreadingDemoimplementsRunnable {
5.     publicvoidrun()
6.     {
7.         try {
8.             System.out.println(
9.                 "Thread " + Thread.currentThread().getId()
10.                 + " is running");
11.         }
12.         catch (Exceptione) {
13.             System.out.println("Exception is caught");
14.         }
15.     }
16. }
17.  
18. // Main Class
19. classMultithread {
20.     publicstaticvoidmain(String[] args)
21.     {
22.         intn = 8;
23.         for (inti = 0; i< n; i++) {
24.             Thread object
25.                 = newThread(newMultithreadingDemo());
26.             object.start();
27.         }
28.     }
29. }
30.

Result/Output/Writing Summary:

Learning outcomes (What I have learnt):

Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Demonstration and Performance 5
2. Worksheet 10
3. Post Lab Quiz 5

You might also like