• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Need help interpreting this script

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Haha, awesome, thanks a lot. I was doing exactly the same thing as Raymond in that post. Thanks again!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic