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.

Recommended Answers

All 3 Replies

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

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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.