Help needed - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help needed

venus_m85venus_m85 Posts: 1Member
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.