Вот пример текстового файла, из которого я читаю. Это продолжается дольше, но суть в этом.
Код: Выделить всё
package hw4;
import java.util.Scanner;
public class HW4
{
public static void main(String[] args) throws Exception
{
int [] first = new int[50];
readIntsTextFile(first, 35, "june.txt"); //Call to method here
}
// Actual method
public static void readIntsTextFile(int[] a, int n, String fileName)
{
Scanner input;
input = new Scanner(fileName);
int count = 1, test;
while(count
Подробнее здесь: [url]https://stackoverflow.com/questions/79800415/inputmismatchexception-when-using-arrays-and-methods-in-java[/url]
Мобильная версия