⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student.java~33~

📁 继承和多态 实验目的: 1、 掌握继承和多态的概念与实现方法 2、 掌握如何从已有的类中派生子类并继承父类 3、 掌握方法的覆盖和重载 实验内容: 设计一个通用的排序算法
💻 JAVA~33~
字号:
package generalSort;

/**
 * <p>Title:Student </p>
 *
 * <p>Description:  A simple class to describ a student, which has three properties and four methods
 *
 ****Property ID represents the student-number of a student
 ****Property Name represents the name of a student
 ****Property flag specify the way to sort students, that's , sorting by its ID or its Name
 ****Method int getID() returns the student-number of a student
 ****Method String getName() returns the name of a student
 ****Method int getFlag() returns the value of property flag
 ****Method String toString() returns the description of a student with properties ID & Name
 *
 * </p>
 * <p>Copyright: Copyright (c) 2008 All rights reserved</p>
 * <p>Organization:Shandong University </p>
 * @Email:ruohanxiao@yahoo.com.cn
 * @author: Xiao Ruohan
 * @version 1.0
 */
public class Student {
    private String Name;
    private int ID;
    private int flag = 1;
    private Blanks blanks;
    public Student() {
    }

    public Student(int id, String name) {
        this.ID = id;
        this.Name = name;
    }

    public Student(int id, String name, int flag) {
        this.ID = id;
        this.Name = name;
        if (flag != 1) {
            this.flag = 2;
        }
    }

    public int getFlag() {
        return this.flag;
    }

    public int getID() {
        return this.ID;
    }

    public String getName() {
        return this.Name;
    }

    public String toString() {
        return ("The current student's ID & Name is " + this.ID +
                blanks.blanks(String.valueOf(this.ID), 5) +
                this.Name);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -