aspose file tools*
The moose likes Beginning Java and the fly likes Using Method Invocations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using Method Invocations" Watch "Using Method Invocations" New topic
Author

Using Method Invocations

Kenneth Kim
Greenhorn

Joined: Aug 11, 2005
Posts: 10
Hi I have the following code:


Do you see the part of my code with the XXXXX's? I have the user input the name of a color in the string earlier in the program. How do I use the string in place of the XXXX's? The name of the string is "color", quite appropriately.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Here's one way...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 433
You can't pass [i]color[i/] as an arg to Color.Just use if-else to determine which Color to choose.


Anyone has better method?


To be or not to be. It's a question.
Julien Grenier
Ranch Hand

Joined: Sep 01, 2005
Posts: 41
Hi,
if you are using java 5.0 you can do something like that.




Julien
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Method Invocations