Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

семестр 5 / Lab2 / java / Person

.java
Скачиваний:
6
Добавлен:
18.02.2023
Размер:
615 б
Скачать
package com.company;

public class Person {
    private String name;
    public static Person first;
    public static Person last;
    public Person next;
    public Person()
    {
        next = null;
        if(first == null) first = this;
        if(last != null) last.next = this;
        last = this;

        name = "Vladimir";
    }
    public static void print()
    {
        Person i = first;
        while(i != null)
        {
            i.show();
            i = i.next;
        }
    }
    public void show()
    {
        System.out.printf("Name: %s\n", name);
    }
}
Соседние файлы в папке java