Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help interpreting this script

 
Jake Miller
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haha, awesome, thanks a lot. I was doing exactly the same thing as Raymond in that post. Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic