I have 2 classes but this is my main--- how do i have it so it takes 1 name at a time and displays 4999 spaces between the names? the test class is below.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Friend extends Thread //make the class
{
private String spac = " ";
private final int wait = 4999;
private final int END = 1;
private String fName;
public Friend(String name)
{
fName = name;
}
public void run()
{
for(int x = 0; x < END; ++x)
{
System.out.print(fName);
try
{
sleep(4999);
}
catch(InterruptedException e)
{
}
}
}
}
Test Class:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class testFriend //make the class
{
public static void main(String[] args)
{
Friend a = new Friend(" Trista ");
Friend b = new Friend(" Nate ");
Friend c = new Friend(" Ash ");
a.start();
b.start();
c.start();
}
}
Bookmarks