Help needed

I got a problem in one of my assignmnets I should do like this:
I want to implement a shell that runs the three
commands CAT,LS,CP.So Modify the methods and implement the classes as follows. Create a new command object.
Start a new thread that runs the desired command. Check if the last string in the scanned line
is equal to &. If it is not an &-sign, then wait for the thread by a join.
thats my problem
Can anybody guide me to solve my problem.

import java.util.*;

public class Main {

/** Creates a new instance of Main */
public Main() {

* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Shell sh=new Shell();;


class Shell {
public void run(){
boolean stop=false;
Scanner scanner=new Scanner(;
System.out.print("Enter Command:>");
String line=scanner.nextLine();
String[] inputStrings=line.split(" ");

else {
//create a command object and set the attributes

//create a new thread that runs the command

//check if the command should be run in the background or foreground

class Command {
public String theCommand;
public String[] args;

class CommandRunner extends Thread {
Command myCommand;

public void run(){


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!