获取java.lang.string从未使用过的错误

时间:2018-11-15 01:08:44

标签: java

请问任何人解释为什么我会收到此错误?不只是这个

从未使用过构造函数'StockMachine(java.lang.String)'

但也有人说从未使用过Method。我不确定为什么会这样。这是我的代码段:

import java.io.*;
import java.util.*;
import java.io.FileInputStream;

public class StockMachine {

    private StockPriceService [] stockPriceServices;

    private String tickerSymbols[];

    private final int NUMBEROFSERVICES = 3;

    public StockMachine(String fileName) {
        stockPriceServices = new StockPriceService[3];
        stockPriceServices[0] = new UHStockService();
        stockPriceServices[1] = new NLPService();
        stockPriceServices[2] = new ExternalService();
        try {
            FileInputStream fis = new FileInputStream(fileName);
            Scanner scan = new Scanner(fis);
            this.tickerSymbols = new String[scan.nextInt()];
            int i = 0;
            while (scan.hasNext()) {
                this.tickerSymbols[i] = scan.next();
                i++;
            }
        }

        catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
}

0 个答案:

没有答案