Answer the question
In order to leave comments, you need to log in
Java creating array elements!?
There is one such question that torments me and prevents me from further promoting the development of an android application, I remember this was in C, but somehow it was decided.
Here I have created a variable with an unlimited number of array elements.
Example: String aServer[]=aTemp[1].split(" ");
Here the elements are generated automatically
But if I declare final temp[] in another activity (class);
Also I will try to make something banal class Name. temp=aServer What
I
get, I even get nothing, it just won't compile
And the task is to pass one array (unlimited number) to another array (unlimited number), and then use the final variable, somehow it was the same aServer but written later, when the creation event occurs, the elements of aServer will be generated.
Who knows, help, not long ago I began to study java and ran into this.
Answer the question
In order to leave comments, you need to log in
Writing programs is a way of expressing your thoughts. To begin with, learn to express your thoughts in natural language, with this you are bad.
You really don't know how to write in Russian. From what I understand (not sure if it's correct) - you are trying to assign a new value to a variable that is in another class and has the "final" modifier. Read about the "final" modifier - opensourcerules.net/java/gl4_2.html
Moreover, it's good practice to assign values through "setters" rather than directly. In addition, your temp variable does not have an access modifier, which means that the variable will only be available inside its package folder.
Yes, and it would be nice to post the code and compiler errors in order to understand what you are trying to do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question