Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Array output  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is for loop in the display method only printing the first argument (oneArray) correctly? It is only repeating the other arguments...

 
Collin Sampson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I see.

It should've been: Array Output (No rush though) ;D

 
Marshal
Posts: 24501
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So what is your question? It looks like it's something about what the programming is outputting. Could you explain that a bit more?
 
Collin Sampson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Paul.

The Program is Outputting:

 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Change your program to something more manageable, like 3 or 4 months.

2. Step through it manually, making note of what you think the values of relevant variables will be at various points, which code paths will be followed for if statements, how many times a loop will execute and what will happen/change each time through, etc.

3. Add a bunch of print statements so that running the program will print out what's actually happening with regards to the above. (Or use a debugger if you're comfortable with one.)

4. Compare your expected output with the actual output. Where they differ, you've narrowed down the source of a problem.

5. Try to figure out why that difference arose. Validate or disprove your own assumptions.

6. If you can't figure it out, or if you don't see a difference, you need to look somewhere else. Go back to step 2, and reevaluate what "relevant" means.

It may seem like a long and tedious process, but in the vast majority of cases, it's faster and more effective than just guessing. Skilled professionals do it this way too. The really skilled ones start with something manageable before they go for the full-blown thing, and write code to test their real code before they write their real code.

And of course, if you get to where you really can't make any more progress, post again, showing what you've done, what output you got, and what output you expected. (I didn't see that last one in your most recent post.)
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't understand what your question is. You desire output that is different from what you are getting, but you haven't explained what it is you want, and you haven't really shown the output you do get. How about starting with a clear explanation of that the program is meant to do?
 
get schwifty. tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!