Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-28-2008, 06:16 PM   #1
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, 03:48 AM   #2
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
Maybe you can use the reflection API:

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.


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 07:05 AM
Bash Shell Scripting Dynamic Variable naming question ZuG Programming 2 02-07-2007 03:39 PM
Java Dynamic Class Loading wildcat22 Programming 2 12-29-2005 01:09 PM
error loading dynamic library with Java trutnev Programming 4 06-01-2005 04:33 PM
java variable redhatrosh Programming 6 03-17-2005 11:55 AM

All times are GMT -5. The time now is 07:26 AM.

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