[android-developers] Re: Java newb question about a public array class member
Replace: String[] wordList = {
"American","American","Brown","Christian","Congress","Doctor","England","English"
};
with: this.wordList = new String[]{
"American","American","Brown","Christian","Congress","Doctor","England","English"
};
On Apr 1, 12:24 pm, trans <transf...@gmail.com> wrote:
> I don't really get Java. I'm trying to define a public array member,
> like so:
>
> public class MyClass {
>
> // alphabetical list of words
> private String[] wordList;
>
> // constructor
> public MyClass() {
>
> String[] wordList = {
>
> "American","American","Brown","Christian","Congress","Doctor","England","English"
> };
>
> }
>
> public String[] getList() {
> return wordList;
> }
>
> }
>
> When I try to access wordList, as in getList(), I get a null error.
> Why?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home