【发布时间】:2012-03-20 08:33:27
【问题描述】:
我对编程有点陌生,所以我相信这是一个简单的答案。
基本上,在我的主要方法中,我想这样做:
...
wordtime = new LabelField("" + DataStored.words[0]);
...
现在在 DataStored 类中,我有: ...
public static String[] words;
{
words = new String[2];
words[0] = "Oil sucks!";
words[1] = "Do you know that I can talk?";
}
...
所以每次我尝试编译程序时,它都会在主类中停止,说 DataStored.words[0] 为空。我怎样才能让它填充其他类的字段?提前谢谢!
【问题讨论】: