954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

HELP!!!need help with command line arguments and creating a package in java. HELP!!!!

need help with command line
arguments and creating a package in java. i need to hand this in soon and obviously i cant do it can someone help me.

Attachments lab14.pdf (70.64KB)
Pumbaa_hughes75
Newbie Poster
2 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

We will help you as soon you show us what you did so far. However, NOBODY will do your homework for you

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

Yeah we aren't allowed to help with homework unless effort has been shown. But to get you started:

java myprog


is actually asking java to execute the file myprog.class so of course you must have compiled it first.
By typing:

java myprog data1 data2 data3


you cause args to store the following information:

args[0] = "data1"
args[1] = "data2"
args[2] = "data3"


You can find out how many elements are stored in args by using the fact that it's an array:

len = args.length;


Note that length is variable, not a method as with the String class. Well that's a good start off I'm sure :) Oh check out http://java.sun.com/docs/books/tutorial/essential/environment/cmdLineArgs.html

All the best!

PoovenM
Junior Poster
151 posts since Aug 2006
Reputation Points: 56
Solved Threads: 11
 

thnks for the help i'll show what i've donew soon..... and hopefully you can show me wht to do frm then on... thanks

Pumbaa_hughes75
Newbie Poster
2 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You