This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes how can I print out the value of this list without havig to change evrything to static? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how can I print out the value of this list without havig to change evrything to static?" Watch "how can I print out the value of this list without havig to change evrything to static?" New topic
Author

how can I print out the value of this list without havig to change evrything to static?

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Here is the code:



But up in the main method, print(); is underlined and the only way I can get rid of errors is by changing everything to static. How can I print the value of ids out without having to do this.?

True wisdom is in knowing you know nothing - Socrates
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

Create an instance?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Ah so its that simple eh?

I just did



Now do I actually need the loadNodes() method in there like I have it (this method is the one that changes the value of ids) or do I just need the prin() method? I would think the former otherwise the values would never get changed, just the print method would be invoked which would return nothing at all right?

I would try myself but the web service that is the data source has been down all weekend so have been pretty restarined with what I can get done this weekend. Bad timing too, I have to have something to show by Wednesday...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

I favor a method called "print" not be making a web service call - that would be confusing. I think what you have is good.

In terms of testing, it's a good practice to create a "mock" for the web service part so you can test without an actual web service.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can I print out the value of this list without havig to change evrything to static?
 
Similar Threads
rich:tree working now... all the work has finally paid off - THANKS
Trying to bind data to a TreeNode attribute using data read from a web service with simple xml
Need to call a method to populate my list, then have that list bound to rich tree
Trying to figure out why Im getting "cannot be resolved" error
java.util.ArrayList is not compatible with class java.lang.String exception (SOLVED)