Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, so I need someone to look over this code and see if im on the right path. I feel like im missing something. Here

Hello,
so I need someone to look over this code and see if im on the right path. I feel like im
missing something.
Here is the assignment:
Create a class called Slogans. This class will extend the Thread class. This thread will read from a file several quotes that are on each line. It will pick a quote randomly and display it to the console. It will change quotes every 7 seconds. This will be updated in the final project to display in a GUI.
Here are the quotes I need to display:
May the force be with you
Don't cross the streams
Live long and prosper
I'll be back
Strength and honor
Yo, Adrian
Autobots, transform and roll out
Hulk Smash!
With great power comes great responsibility
There is only one thing we say to death: not today
Here is the code:
I started off with this:
public class Main implements Runnable {
String msg;
Main(String s)
{
msg=s;
}
public static void main(String[] args) {
Thread t1 = new Thread(new Main("m"));
Thread t2 = new Thread(new Main("n"));
t1.start();
t2.start();
}
public void main(String[] args){
}
I'm sorry the language is for Java.

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

Students also viewed these Databases questions