所以我想要做的是使用Scanner = new Scanner(new File("list.txt"))
. 它需要使用标记"DONE"
来结束文件底部的循环。
我该怎么做?array[arraySize] = value();
给我一个类型不匹配
public class List
{
public static void main(String[] args) throws FileNotFoundException
{
double array[] = new double[100];
int arraySize = 0;
String value;
String sentinel = "DONE";
Scanner inFile = new Scanner(new File("list.txt"));
value = inFile.next();
while (value != sentinel)
{
array[arraySize] = value();
arraySize++;
value = inFile.next();
}
}
}
D'oh....那些错误是可耻的,哈哈。谢谢大家让它工作=]