0% found this document useful (0 votes)
7 views2 pages

Exp 1

The document contains a Java program that defines three classes extending the Thread class, each responsible for printing the multiplication table of a given integer. The main method takes three integers as input from the user and starts three threads to display the multiplication tables concurrently. Each thread prints the multiplication results from 1 to 10 for its respective integer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Exp 1

The document contains a Java program that defines three classes extending the Thread class, each responsible for printing the multiplication table of a given integer. The main method takes three integers as input from the user and starts three threads to display the multiplication tables concurrently. Each thread prints the multiplication results from 1 to 10 for its respective integer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

class a1 extends Thread {


int i1;
a1(int i) {
i1 = i;
}

public void run() {


for (int b = 1; b <= 10; b++) {
System.out.println(i1 + "x" + b + "=" + (b * i1));
}
System.out.println("\n");
}
}

class a2 extends Thread {


int j1;
a2(int j) {
j1 = j;
}

public void run() {


for (int c = 1; c <= 10; c++) {
System.out.println(j1 + "x" + c + "=" + (c * j1));
}
System.out.println("\n");
}
}

class a3 extends Thread {


int k1;
a3(int k) {
k1 = k;
}

public void run() {


for (int d = 1; d <= 10; d++) {
System.out.println(k1 + "x" + d + "=" + (d * k1));
}
System.out.println("\n");
}
}

class exp1_ajava {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
int j = sc.nextInt();
int k = sc.nextInt();

a1 ob1 = new a1(i);


ob1.start();

a2 ob2 = new a2(j);


ob2.start();
a3 ob3 = new a3(k);
ob3.start();
}
}

You might also like