This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Yeah, only the 'String[] args' (or 'String[] whatever') works. Marius
David Junta
Ranch Hand
Joined: Dec 10, 2000
Posts: 86
posted
0
Thanks, Marius. One of the places I saw String args[] was here in JavaRanch in the first few lines of code on the "How To Make Methods" page: http://www.javaranch.com/drive/method.html I assume it works if it was there, but I haven't tried compiling it or running yet. Perhaps I shall.
David, No in Java there is NO difference between the two examples you gave. This is VERY important to know about Java! If you don't know that these two are equal then you better start reading some Java books ... You have shown an easy example, 1 dimensional array. For 2 dimensional arrays it gets even more interesting: String[][] a == String[] a[] == String a[][] You had better get used to this because it is all over in Java, as it is a personal preference NOT a specified Java requirement. Try it with your favorite Java compiler! Manfred. Bad code can always be used as good examples on what not to do!
Marius Holm
Ranch Hand
Joined: Sep 11, 2000
Posts: 84
posted
0
Really, Manfred? Well, thanks for the enlightment. I didn't know that. But it doesn't make sense, does it? Is it just a matter of flavor, or does it have other implications? I'd love to read a good Java book, can you recommend one? (And how would that be with 4-dimensional arrays? No, just kidding! ) Marius
Marius, A good book that is free is: Thinking in Java by Bruce Eckel. he has his own web site that lets you download an Adobe PDF of the book. He explains concepts very well and has exercise programs that help a lot. Best FREE book I have ever read about Java! Another good book is: The Complete Java 2 Certification Study Guide by Simon Roberts, et al. This book is geared towards certification but the explanations are VERY clear and the examples given are EXTREMELY easy to understand. Roberts makes the inner concepts of Java very easy to understand without complex examples that don't relate to the current topic. The book is also divided up into exam objectives that help to break up the Java elements. I think this book is the best Java book on the market for certification hands down. It costs about $45 though ...
Need a method that would check to see if a word being added to a list is already in the list at the current position and if so to increment the list count but not add the word. Don't know how to do this. I have method to append the list, would it be better to write some sort of if statement for these methods instead.
in the main L2.append(new WordElem("Mountain", 5)); want to append the list, check to see if the item that is being added is at the current position(end of the list) and if so increment the count only. thanks