Как мне поместить переменные в массив объектов? [закрыто]

      private User uArr [] = new User [100];
private int userNum;
private String name
private String surname;
private int age;
private long creditNum;
private String email;
private boolean gender;
private boolean pcGamer;
private String username;
private String password;

public UserManager () throws FileNotFoundException
{
    Scanner scFile = new Scanner (new File ("Users.txt"));

    while (scFile.hasNext ())
    {
        String line = scFile.nextLine ();
        Scanner scLine = new Scanner (line);

        for (int i = 0; i < 100; i++)
        {
            userNum = scLine.nextInt ();
            name = scLine.next ();
            surname = scLine.next ();
            age = scLine.nextInt ();
            creditNum = scLine.nextLong ();
            email = scLine.next ();
            gender = scLine.nextBoolean ();
            pcGamer = scLine.nextBoolean ();
            username = scLine.next ();
            password = scLine.next ();
            uArr [i] = userNum, name, surname, age, creditNum, email, gender, pcGamer, username, password;

Итак, в основном я работаю над оценкой для школы, но не могу понять, как вставить переменные, которые я создал, в свой массив объектов. В массиве требуются следующие переменные: Integer, String, String, Integer, Long, String, Boolean, Boolean, String, String. Если бы кто-то мог мне помочь, я был бы благодарен.

0 ответов

Другие вопросы по тегам