Create a simple Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0. For your created code, please be provide a detailed analysis of appropriate concepts that could impact your application. Specifically, please address:
In case of any queries, please revert back.
public class Main extends Thread
{
public static void main(String[] args)
{
//We have referenced thread1 as the Main thread of the
program.
Thread thread1=Thread.currentThread();
//Fort this thread to work first, we set its priority as max.
thread1.setPriority(MAX_PRIORITY);
//Countdown Begins
for(int k=1;k<=20;k++){
System.out.println("Count 1 : "+ k);
}
//Now, we declare thread2 as Child process.
NextThread thread2=new NextThread();
//start the second concurrent thread
thread2.start();
}
}
/*This class is extended as Class acts as thread. When start()
is encountered, run() is executed.*/
class NextThread extends Thread
{
@Override
public void run()
{
for (int i = 20; i >= 1; i--)
{
System.out.println("Countdown 2 : "+i);
}
}
}
}

Some Vulnerabilities are :-
Performance issues with concurrency :-
Some Threads may block the working of other threads. They may clog the CPU which may lead to starvation. Useless excessive Threading is Harmful and may lead to some unexpected errors. Due to their complicated mechanism, threads have to be used with extra care. So, they have performance issues.
Vulnerabilities exhibited with use of strings :-
Strings are unprotected and can be manipulated easily if kept public. Straightforwardly incorporating client contribution to an organization string lets an aggressor infuse design particulars into the arrangement string. This is especially risky in programming dialects. On the off chance that assailants can compose information esteems to memory, they can regularly use that to oversee the framework.
Security of the data types exhibited. :-
The Java language is exacting in its meaning of the language.All crude variables in the language are destined to be a particular size.All tasks are characterized to be acted in a predefined order.Two right Java compilers will never give various outcomes for execution of a program.An get to modifier limits the entrance of a class, constructor, information part and technique in another class. In java we have four access modifiers.These are default, public, private,protected. This prevents leakage of data from a class as in OOPS, we require data to be strictly contained in its domain.
Create a simple Java application that will exhibit concurrency concepts. Your application should create two threads...
HW: Create a java application that has two threads by implementing the Runnable interface (aside from the main thread) • Change the names of all threads • Change the priority of all threads (use the priority constants in Thread • Print the numbers from 0 to 9 o One number per one 2 seconds for the first thread College of Computer Operating Systems ( Laboratory Manual Lab o One number per 4 seconds for the second thread o The main...
Java Concurrency! You have been given a simple API to buy and print postage. Write a program that submits each incoming order to the API and then prints the shipping label. Unfortunately each call to the shipping label API is SLOW… To compensate for this, use concurrency so that your program can be making several calls to the API at one time. We also need to keep track of our expenses, so make sure to calculate how much money is...
Develop a multithreaded application in C# that creates 4 separate threads. Associate each thread to one distinct method. Each method should contain time-consuming calculations (if you wish, you may use for loops to, to make the execution time even longer.) You may wish to get the input from the user and pass them to the 4 methods that would run in 4 threads you created. The idea is to let all the methods run concurrently. Please make sure that your...
In JAVA Create a PrintChar class that implements Runnable. The constructor should accept a character and an integer as parameters. The run method should print the character the number of times indicated by the integer. Create an application that instantiates two PrintChar objects, one passed “A” and 200 and one passed “B” and 200. It then instantiates and starts two thread objects, one for each of the two PrintChar objects. Experiment with the resulting system, using different numerical parameters for...
Create the logo as shown in
Java in an applet or frame. It should be as close as
possible, including the Virus
Logo. Draw the logo using ovals,
lines, rectangles, and strings, changing colors and using draw or
fill as necessary. Change to appropriate virus colors
(like Blue and Cyan)
and fonts for the
text in
the drawing. Everything should be
drawn in paint() with
your Graphics object. After creating one virus, usecopyArea() to copy
the virus bugs to other...
java Create a Queue class based on java.util.LinkedList class. Your Queue class should have an enqueue(), dequeue(), peek(), and isEmpy() methods. Create a new Java Application that has the following methods: A method to randomly generate a number of elements between two given values and save them in a queue A method to print a queue (10 elements per line). The original queue should remain as is after the print A method to return the number of elements on the...
In Java.
Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
I've been assigned to create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the...
JAVA ONLY. For this assignment you will create an employee application, containing contact information, salary, and position. You will also define the type of company. Is it an engineering firm, a supermarket, or a call center? Once the application has been completed, I should be able to perform a query for any piece of information associated with each employee. For instance, if I search for employees who make over $50,000, all of the employees whose salaries are greater than $50,000 should...
Java: Write an application that has an array of at least 20 integers. It should call a method that uses the sequential search algorithm to locate one of the values. The method should keep a count of the number of comparisons it makes until it finds the value. Then the program should call another method that uses the binary search algorithm to locate the same value. It should also keep count of the number of comparisons it makes. Display these...