This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes thread and returning a method from object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "thread and returning a method from object" Watch "thread and returning a method from object" New topic

thread and returning a method from object

ilteris kaplan
Ranch Hand

Joined: Jan 21, 2006
Posts: 38
I have three different classes, one is main one is dataGet and the last one is crawler.

so dataGet extends thread and calls crawler from inside just to make sure main is not halted, but I am kind of clueless how I am going to call a method inside of crawler since it is only instantiated in dataGet class and I am trying to call this method from my main class.

What do you guys say about this situation?
Thank you in advance

Jeremy Tartaglia
Ranch Hand

Joined: Mar 11, 2004
Posts: 62
Simply put, without access to a pointer (or reference) of a crawler class, you can't. If you want, you can make a list of all crawler classes, and store them in a static list of main:

That's sort of a cop out, but it works.
[ February 25, 2006: Message edited by: Jeremy Tartaglia ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: thread and returning a method from object
It's not a secret anymore!