Originally posted by JC Bismark:
[QB]I was confused on how to start but I think it will be like this:
This much won't compile. You might start by fixing that much. It also appears that your logic is saying
if arg1 is null while arg1 is not null ... I hope I'm misunderstanding something.
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
orYour 1st command-line argument was baaad
Then change the printout to the conventional error message, which reads something like:Please enter a command-line argument
To be honest, there really isn't a need to use OO here at all. It's pretty much a linear one-method job to parse the arguments, so you can keep it all static (do it all in main really). OOP comes into its own when you start constructing complicated inheritance models, not simple procedural programs.But I am not sure if it is done in the right or the best way (especially oops concepts and performance).
And I forgot to mention above that you should conform to the Code Conventions for the Java Programming Language as it will help make your code more readable by others (it also saves lines by not putting every { on separate lines).Can you please verify the code and tell me how I can improve my coding.
Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
I don't follow - what sort of design are you thinking about?A simple HashMap will help you to count the ocurrences [sic] of each letter.
Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Originally posted by JC Bismark:
Thank you so much for your input guys,I can see that there is several paths to solve the exrecice.I learn so much on this network...
Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Originally posted by Charles Lyons:
And I forgot to mention above that you should conform to the Code Conventions for the Java Programming Language as it will help make your code more readable by others (it also saves lines by not putting every { on separate lines).
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
And I forgot to mention above that you should conform to the Code Conventions for the Java Programming Language as it will help make your code more readable by others...
Disclaimer: The author of this post makes no claims, implied or otherwise, as to her ability to understand anything but the simplest of answers. Further, the author of this post has no programming background whatsoever and has taken one Java Programming class which was 9 weeks long. She does want to learn, so please teach patiently.