Command Line Argument - URGENT!
Hi guys,
this is my question that i need help in:
Write an application that takes as a command line argument a word and outputs
how many character are in the word.
If called with the command line arguments Computing and Freedom would
output:
Computing has 9 characters
Freedom has 7 characters
have no idea how to do it, so please someone help!!
Thanks!
Re: Command Line Argument - URGENT!
The following should be sufficient information on how to undertake this task.
Scanner.
String.
Check out the different methods available to you, especially nextLine() from Scanner and length() from String.
Re: Command Line Argument - URGENT!
Do not mark your posts as URGENT. Your time constraints are your problem not ours. You are not more important than anyone else seeking help. Many like me refuse to help people who scream URGENT at us, which hinders your chances of getting help not enhancing it.
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
newbie
The following should be sufficient information on how to undertake this task.
Scanner.
Since the requirement states using command line arguments, the Scanner class would not be needed.
Re: Command Line Argument - URGENT!
Ah indeed, must've read his post wrong :)
Re: Command Line Argument - URGENT!
Here is an example of reading a command line argument:
Code Java:
public class CommandLine {
/**
* JavaProgrammingForums.com
*/
public static void main(String[] args) {
System.out.println(args[0]);
}
}
The first argument you give when compiling the code will be printed out. You can take it from there..
If you are using the Eclipse IDE, please see - http://www.javaprogrammingforums.com...s-eclipse.html
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
Junky
Do not mark your posts as URGENT. Your time constraints are your problem not ours. You are not more important than anyone else seeking help. Many like me refuse to help people who scream URGENT at us, which hinders your chances of getting help not enhancing it.
then why have an option of urgent if anyone isnt allowed to use it?
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
Rads23
then why have an option of urgent if anyone isnt allowed to use it?
What option are you talking about? You just added an annoying all-caps "URGENT" to the title. That's not an option, that's you being obnoxious. Follow that with a homework dump, and I'm surprised you got any help at all. You should be thanking them, not arguing about whether you should or should not be given the option to post annoying titles.
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
KevinWorkman
What option are you talking about? You just added an annoying all-caps "URGENT" to the title. That's not an option, that's you being obnoxious. Follow that with a homework dump, and I'm surprised you got any help at all. You should be thanking them, not arguing about whether you should or should not be given the option to post annoying titles.
As matter of a fact, i thanked the person who helped me! Dont talk if you dont know.
Re: Command Line Argument - URGENT!
Quote:
thanking them, not arguing
Quote:
Dont talk if you dont know
Noone was talking, only writing :)
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
Rads23
As matter of a fact, i thanked the person who helped me! Dont talk if you dont know.
That's fine, but then you followed up with a confrontational "why let me do this" when all that was said was that marking your threads as urgent annoys people and decreases your chances of getting help- which continuing with "debates" will certainly not fix. Best to say "okay got it", move on, and don't do it in the future.
For more information, see the link in my signature on asking questions the smart way, especially the parts titled "Don't post homework questions", "Don't flag your question as URGENT, even if it is for you", and "Courtesy never hurts, and sometimes helps".
Re: Command Line Argument - URGENT!
Quote:
Originally Posted by
newbie
Noone was talking, only writing :)
Lol, Ok sorry for any rudeness! :) Appreciate all the help given, thank you all! x