Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 读取文件并在数组中存储不同的信息字段_Arrays_File_Methods - Fatal编程技术网

Arrays 读取文件并在数组中存储不同的信息字段

Arrays 读取文件并在数组中存储不同的信息字段,arrays,file,methods,Arrays,File,Methods,所以我有一个作业要读一个文本文件,包括学生姓名、地址、出生年份、电子邮件和身份证号码。我必须创建一个将文件作为参数的方法。在该方法中,我应该读取所有信息并将其存储在数组中的一个元素中。它必须返回学生数组。我只创建了方法头,在那之后我真的迷路了。显示了一名学生的输出示例。谢谢你事先的帮助 姓名:约翰·居里 学号:8051413715 地址:洛杉矶纽约大道800号 电邮:JohnCurie@utep.edu 年龄:18 import java.io.File; import java.io.Fil

所以我有一个作业要读一个文本文件,包括学生姓名、地址、出生年份、电子邮件和身份证号码。我必须创建一个将文件作为参数的方法。在该方法中,我应该读取所有信息并将其存储在数组中的一个元素中。它必须返回学生数组。我只创建了方法头,在那之后我真的迷路了。显示了一名学生的输出示例。谢谢你事先的帮助

姓名:约翰·居里 学号:8051413715 地址:洛杉矶纽约大道800号 电邮:JohnCurie@utep.edu 年龄:18

import java.io.File;

import java.io.FileNotFoundException; 

import java.util.Scanner;

  public class Runner{
     public static void main(String[] args) throws  
   FileNotFoundException{
    
Student[] allStudents = ReadAllStudents("input.txt");
    
    
System.out.println("There are: "+allStudents.length+"   students."); 

System.out.println();



public static Student[] ReadAllStudents(String fileName) throws 
 FileNotFoundException{



}