LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-28-2008, 05:16 PM   #1
ufmale
Member
 
Registered: Feb 2007
Posts: 385

Rep: Reputation: 30
dynamic variable name in JAVA


I am looking for a way to create variable name during run-time in JAVA similar to what perl does with $$xx.

In perl you would do,
$a,$b,$c = split("-", "I-want-to");

so in this case $$a <==> $I
$$b <==> $want etc.

Is there a similar way to do that in JAVA?
 
Old 07-29-2008, 02:48 AM   #2
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
Maybe you can use the reflection API: http://java.sun.com/docs/books/tutor...ect/index.html.

I would say to ask though about what you want to do, and not how you want to do it. Java and Perl are quite different and maybe your problem has a different solution in Java.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script and Dynamic variable xanthium Programming 11 07-12-2011 06:05 AM
Bash Shell Scripting Dynamic Variable naming question ZuG Programming 2 02-07-2007 02:39 PM
Java Dynamic Class Loading wildcat22 Programming 2 12-29-2005 12:09 PM
error loading dynamic library with Java trutnev Programming 4 06-01-2005 03:33 PM
java variable redhatrosh Programming 6 03-17-2005 10:55 AM


All times are GMT -5. The time now is 10:11 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration