Reading from file double value using Scanner - InputMismatchException?

后端 未结 3 1800
无人及你
无人及你 2020-12-22 06:21

I tried read from file double values and using Scanner with this aim.

It throws InputMismatchException :

\"input.txt\"  java.util.InputM         


        
3条回答
  •  鱼传尺愫
    2020-12-22 06:30

    I found solution - need to create File object and then feed it to scanner class:

    String filename = "input.txt"; 
    File newFile = new File(filename);
    Scanner in = new Scanner(newFile);
    

提交回复
热议问题