File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Need help interpreting this script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help interpreting this script" Watch "Need help interpreting this script" New topic
Author

Need help interpreting this script

Jake Miller
Ranch Hand

Joined: Jun 27, 2007
Posts: 43
Here is a 2 part script taken from Head First Java:



And the output:


helloooo...
helloooo...
helloooo...
helloooo...
10


Now I went through and tried to "run" this program myself and here is how I did it:

(I hope this shows up ok).
Clearly I am wrong in adding these values up. I realize this may be a difficult question to answer online, but could someone point to where I went wrong? Thanks in advance


Edit by mw: Added code tags to formatted "table."
[ July 16, 2007: Message edited by: marc weber ]
Jake Miller
Ranch Hand

Joined: Jun 27, 2007
Posts: 43
Wow, that table did not show up at all how I wanted it to. Those are supposed to be columns with the headers: "x" "e1.count" "e2.count" and the values underneath. The key value (I think) is the 11 I got vs the 10 the program outputs.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Jake Miller:
Wow, that table did not show up at all how I wanted it to. Those are supposed to be columns...

To preserve formatting with spaces like this, you can put the text inside code tags. I edited the original post for you.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See this post and try running the modified version of the code I posted there. Let us know if this helps.
Jake Miller
Ranch Hand

Joined: Jun 27, 2007
Posts: 43
Haha, awesome, thanks a lot. I was doing exactly the same thing as Raymond in that post. Thanks again!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help interpreting this script
 
Similar Threads
Classes and Projects Chapter 2 of Head start JAVA pool puzzle
Can someone explain how this code works?
A Puzzle...sort of
Would like help about this excercise in HFJ
Head First Jave "EchoTestDrive" Pool Puzzle