• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

command line arguments

 
ye zeya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear ALL..
I am a very beginner to Java and now learning it.Here some little point I want to know clearly.

[edit]Add code tags. CR[/edit]


I made the above program but have error.The idea is to accept the command line arguments and display how many arguments are there.
I can make it by the following alternative way.However..I also would like to know why question for my first program.
Thank you..">
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ye,

Welcome to JavaRanch!
I made the above program but have error

I can successfully compile and run it at my end. What error is that?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
Please use the CODE button; I have edited your original post so you can see how much better it looks.
campbell@linux-747u:~/java> java readArgs Campbell Ritchie Ye Zeya
Campbell
Ritchie
Ye
Zeya
The Number of Arguments = 4
I can see no errors; please supply more details of your problem.

 
ye zeya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arr....Sorry for my childish carelessness. I compiled the program with wrong name readArgs2 in stead of renaming the former program readArgs.java .So the main class does not match the file 's name . .Really sorry for my fault.
Thank you for your kind helps.Next time I will try to avoid such funny mistakes.

 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NeverMind.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We all do things like that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic