File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we define run() in another method of the class ??

 
Catherine austin
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To create Thread we need to override run() in case we implements Runnable interface. But can we define this run() method in another method of that class?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47270
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't understand your question. Sorry.

You cannot have methods inside methods.
You can simply call another method from inside run, like thisI don't think that answers your query, however.
 
Sathiesh Kumar Vs
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems your need is to run() a thread inside some other method.

If that is the case, you will have to create a Separate Thread and implements run() method in that. And use that thread here as Campbell said.
Or you can use an anonymous inner class.

Sorry, If I misunderstood your question.
 
Catherine austin
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell and Sathiesh..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic