Start New Discussion within our Software Development Community

The code found below takes command lines arguiments and displays. I want to modify this code in anyway that it would take 2 set of command line arguiments and produces 2 outputs. (That means , Open 2 command prompts and run the code)

ex: first cmd prmpt -> java CmdLnArgmntExp abc
2nd --> java CmdLnArgmntExp def

*in brief --> how to modify the code to Creating multiple instances of Class CmdLnArgmntExp

public class CmdLnArgmntExp {

    public static void main(String[] args) {
        System.out.println("d");
        for (int i = 0; i < args.length; i++)
            System.out.println(args[i]);
    }

}

The code found below takes command lines arguiments and displays. I want to modify this code in anyway that it would take 2 set of command line arguiments and produces 2 outputs. (That means , Open 2 command prompts and run the code)

ex: first cmd prmpt -> java CmdLnArgmntExp abc
2nd --> java CmdLnArgmntExp def

*in brief --> how to modify the code to Creating multiple instances of Class CmdLnArgmntExp

public class CmdLnArgmntExp {

    public static void main(String[] args) {
        System.out.println("d");
        for (int i = 0; i < args.length; i++)
            System.out.println(args[i]);
    }

}

Right now you don't have ANY instances of CmdLnArgmntExp, much less multiple instances. Everything is in main and you have no constructor.

By "open 2 command prompts", do you mean you want two separate console windows? And who/what is opening them? You, a human being, or the program?

This article has been dead for over six months. Start a new discussion instead.