|
Author |
Topic: naming of strings (Read 292 times) |
|
c Guest
|
naming of strings
« on: Jun 26th, 2004, 12:36pm » |
|
hi i wonder why this piece of code wont work; declaring a String works like this: String names = "one, two, three"; String sNames = split(eins, ","); now i want to declare new strings with the names of the list sNames: for(int i=0; i<sNames.length; i++) { String [] sNames[i]; } see the trouble? thanks christian
|
|
|
|
arielm
|
Re: naming of strings
« Reply #1 on: Jun 26th, 2004, 2:42pm » |
|
this kind of constructs would probably work with javascript but not (directly) in java, because it's a compiled language (i.e. it's not processing strings containing "member" names at run-time...) it is possible to use "java refection" to do such things (on field & method names), but 99% of the times, there's a simple, java-straightforward alternative.
|
Ariel Malka | www.chronotext.org
|
|
|
kevinP
|
Re: naming of strings
« Reply #2 on: Jun 26th, 2004, 10:25pm » |
|
on Jun 26th, 2004, 12:36pm, c wrote: String sNames = split(eins, ","); |
| Where does the variable "eins" come from?
|
Kevin Pfeiffer
|
|
|
|