Categories
Uncategorized

Multi threading

Write a JAVA Program to create a class (extending Thread) and use methods Thread class to change name, priority, — — of the current Thread and display the same. class rectangle extends Thread { double length,breadth; rectangle() { length=4; breadth=3; } public void run() { //System.out.println(Thread.currentThread().getName()); Thread.currentThread().getPriority(); System.out.println(Thread.currentThread().getName()+length*breadth); try{ Thread.sleep(1000); }catch (Exception e){System.out.println(e);} } } […]