Results 1 to 4 of 4
- 10-04-2010, 05:20 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 88
- Rep Power
- 0
- 10-04-2010, 05:43 AM #2
Member
- Join Date
- Mar 2010
- Posts
- 88
- Rep Power
- 0
basically i'm writing a class where i could just say
createThread("method');
and a new thread would be spawned in method "method"
- 10-04-2010, 06:01 AM #3
When you start thinking of stuff like that, it's usually time to redesign. Or, if the design really warrants it, use the Reflection API.
db
- 10-05-2010, 12:25 PM #4
Member
- Join Date
- Oct 2010
- Posts
- 7
- Rep Power
- 0
This is very easy:
Method m = getClass().getMethod("myMethod", new Class[0]);
m.invoke(this, new Object[0]);
I assume you want to invoke the method of the calling class with no parameters. Read about reflections for more, makes a lot of sense.
Similar Threads
-
Calling methods into another class? Help please!
By javanator in forum New To JavaReplies: 1Last Post: 03-20-2010, 06:19 PM -
Calling for methods
By soccer_kid_6 in forum New To JavaReplies: 3Last Post: 02-27-2010, 09:12 PM -
Calling methods from superclass
By moaxjlou in forum New To JavaReplies: 7Last Post: 12-11-2008, 12:07 AM -
Calling Methods
By bluegreen7hi in forum New To JavaReplies: 3Last Post: 12-17-2007, 06:22 AM -
need help calling methods
By lowpro in forum New To JavaReplies: 2Last Post: 11-15-2007, 09:53 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks