> Hi, I should know how to do what it says in the subject of this post,
> but I don't. I've almost finished Sams Teach Yourself Java in 24 Hours
[quoted text clipped - 5 lines]
>
> doesn't work.
public class test7 {
public static void main(String[] args) {
for (String arg : args)
System.out.println(arg);
}
}
C:\Documents and Settings\Knute Johnson>java test7 one two three
one
two
three
It doesn't matter which version of the JDK that you have, command line
arguments have not changed.

Signature
Knute Johnson
email s/nospam/knute/
Albert - 19 Dec 2007 23:52 GMT
> > Hi, I should know how to do what it says in the subject of this post,
> > but I don't. I've almost finished Sams Teach Yourself Java in 24 Hours
[quoted text clipped - 26 lines]
> Knute Johnson
> email s/nospam/knute/
I can't get this to work:
class DivideNumbers {
public static void main(String[] arguments) {
if (arguments.length == 2) {
int result = 0;
try {
result = Integer.parseInt(arguments[0]) /
Integer.parseInt(arguments[1]);
System.out.println(arguments[0] + " divided by " +
arguments[1] + " equals " + result);
}
catch (NumberFormatException e) {
System.out.println("Both numbers must be numbers");
}
catch (ArithmeticException e) {
System.out.println("You cannot divide by zero.");
}
}
}
}
java dividenumbers 2 2
Arne Vajhøj - 19 Dec 2007 23:58 GMT
> I can't get this to work:
>
[quoted text clipped - 19 lines]
>
> java dividenumbers 2 2
It would have been a bit easier to troubleshoot if you
had posted the error !
But a guess:
java -cp . dividenumbers 2 2
Arne
Patricia Shanahan - 20 Dec 2007 00:01 GMT
>>> Hi, I should know how to do what it says in the subject of this post,
>>> but I don't. I've almost finished Sams Teach Yourself Java in 24 Hours
[quoted text clipped - 27 lines]
>
> class DivideNumbers {
...
> java dividenumbers 2 2
Have you tried "java DivideNumbers 2 2"?
Patricia
Albert - 20 Dec 2007 06:09 GMT
> >>> Hi, I should know how to do what it says in the subject of this post,
> >>> but I don't. I've almost finished Sams Teach Yourself Java in 24 Hours
[quoted text clipped - 34 lines]
>
> Patricia
Thanks a lot. Problem solved
Lew - 20 Dec 2007 13:48 GMT
>>> I can't get this to work:
>>> class DivideNumbers {
>> ...
>>
>>> java dividenumbers 2 2
Patricia Shanahan wrote:
>> Have you tried "java DivideNumbers 2 2"?
> Thanks a lot. Problem solved
That was it, wasn't it?

Signature
Lew
This post contains one request for information.