/*Write a threading program which uses the same method asynchronously to print the
numbers 1 to 10 using Thread1 and to print 90 to 100 using Thread2. */
Program Name: [Link]
class Printer implements Runnable {
private final int start;
private final int end;
public Printer(int start, int end) {
[Link] = start;
[Link] = end;
}
@Override
public void run() {
for (int i = start; i <= end; i++) {
[Link](i + " "); // Prints each number from start to end
}
}
}
public class NumberPrinter {
public static void main(String[] args) {
Thread t1 = new Thread(new Printer(1, 10)); // Creates Thread1 to print numbers 1 to 10
Thread t2 = new Thread(new Printer(90, 100)); // Creates Thread2 to print numbers 90 to 100
[Link](); // Starts Thread1
[Link]();// Starts Thread2
}
}