Apologies in advance if this is a bit off topic.... but are there any
ActionScripters who know Java on here?
I'm just starting out with Java and I'm stuck.
In Actionscript you can write a for loop and have something like this:
*
for (var i:int=0;i<**myStudnts.length;i++){
this["testStudent**" + i] = new Student();
}*
I'm having trouble expressing the left part of the statement --
"*this["myStudent"
+ i]*" -- using Java.
Any suggestions?
Here's where I'm at with the Java code:
*private static Student testStudent1, testStudent2, testStudent3,
testStudent4, testStudent5;
private static String[][] myStudnts = {{...}, {...}, **{...}, **{...}**,
{...}**};
...
public static void main(String[] args){
**initStudents();
}
public static void initStudents(){
for(int i=0; i<myStudnts.length; i++){
// NOT COMPILING SO FAR:
/////////////////////////////////////////////
(Student)("testStudent"+(i+1)) = new Student(myStudnts[i][0],
myStudnts[i][1],
myStudnts[i][2], myStudnts[i][3],
myStudnts[i][4], myStudnts[i][5]);
}
** }
*Again, sorry if this is a bit off-topic and thank you for taking the time
to read this.
- Tim
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders