how to modify the code to Creating multiple instances of a Class <<Very basic>>

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2008
Posts: 102
Reputation: localp is an unknown quantity at this point 
Solved Threads: 2
localp localp is offline Offline
Junior Poster

how to modify the code to Creating multiple instances of a Class <<Very basic>>

 
0
  #1
Jun 22nd, 2009
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

  1. public class CmdLnArgmntExp {
  2.  
  3. public static void main(String[] args) {
  4. System.out.println("d");
  5. for (int i = 0; i < args.length; i++)
  6. System.out.println(args[i]);
  7. }
  8.  
  9. }
Local P ...
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,836
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: how to modify the code to Creating multiple instances of a Class <<Very basic>>

 
0
  #2
Jun 22nd, 2009
Originally Posted by localp View Post
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

  1. public class CmdLnArgmntExp {
  2.  
  3. public static void main(String[] args) {
  4. System.out.println("d");
  5. for (int i = 0; i < args.length; i++)
  6. System.out.println(args[i]);
  7. }
  8.  
  9. }

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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC