Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Briefly explain the code in area with a /*comment*/ above it /** * A program that tests your implementation that * lists all thread

JAVA Briefly explain the code in area with a /*comment*/ above it

/** * A program that tests your implementation that

* lists all thread groups

* - and threads within each group -

* in the JVM. */

public class CreateThreadGroups

{

public CreateThreadGroups() {

/* Comment Here */

ThreadGroup alpha = new ThreadGroup("alpha");

ThreadGroup beta = new ThreadGroup("beta");

ThreadGroup theta = new ThreadGroup(alpha, "theta");

/* Comment Here */

(new Thread(alpha, new GroupWorker())).start();

(new Thread(alpha, new GroupWorker())).start();

(new Thread(alpha, new GroupWorker())).start();

(new Thread(beta, new GroupWorker())).start();

(new Thread(theta, new GroupWorker())).start();

(new Thread(theta, new GroupWorker())).start();

}

class GroupWorker implements Runnable

{

public void run() {

while (true) {

try {

Thread.sleep(1000);

for (int i = 0; i < 1000000; i++)

;

}

catch (InterruptedException ie) {

}

}

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago