Tuesday, 3 May 2022

A) Write a java program to display name and priority of a Thread.

 

Slip 21Q1

Save as     "Slip21Q21"


CODE:

class Slip21Q1 extends Thread {
    @Override
    public void run() {
        System.out.println("Cuttent thread Name "+this.getName());
        System.out.println("Current thread priority "+this.getPriority());
        System.out.println();
    }
    public static void main(String[] args) {
        Slip21Q1 thread1 = new Slip21Q1();
        Slip21Q1 thread2 = new Slip21Q1();
        thread2.setName("groot");
        thread2.setPriority(6);
        Slip21Q1 thread3 = new Slip21Q1();
        thread3.setName("Amar");
        thread3.setPriority(2);

        thread1.run();
        thread2.run();
        thread3.run();
    }
}


No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...