• student


    package student;

    public class students {
    private int studentId;
    private String studentName;
    private double averageScore;
    private static int nextId = 1;

    public students(String name,double score) {
    studentId = nextId;
    nextId++;
    studentName = name;
    averageScore = score;
    }

    public students(String name){
    this(name,0);
    }

    public students(){
    this("",0);
    }

    public String toString(String name) {
    return name;
    }
    public int getStudentId(){
    return studentId;
    }
    public void setStudentId(int studentId){
    this.studentId = studentId;
    }
    public String getStudentName(){
    return studentName;
    }
    public void setStudentName(String studentName){
    this.studentName = studentName;
    }
    public double getAverageScore(){
    return averageScore;
    }
    public void setAverageScore(double averageScore){
    this.averageScore = averageScore;
    }
    public static void main(String[] args) {

    }

    }

    package student;

    public class operate {
    private students s1 = new students("zhangsan",10.77);
    private students s2 = new students("lisi",11.44);
    private students s3 = new students("wangwu",12.11);

    public static void main(String[] args) {

    operate op = new operate();

    System.out.println(" Id " +op. s1.getStudentId() + " Name " + op.s1.getStudentName() + " Averagescore "
    + op.s1.getAverageScore());
    System.out.println(" Id " + op.s2.getStudentId() + " Name " +op. s2.getStudentName() + " Averagescore "
    + op.s2.getAverageScore());
    System.out.println(" Id " + op.s3.getStudentId() + " Name " +op. s3.getStudentName() + " Averagescore "
    + op.s3.getAverageScore());
    }

    }

    package student;

    public class collageStudent extends students{
    private int courseNum;
    private float creditHour;

    public static void main(String[] args) {

    }

    }

  • 相关阅读:
    IIS服务器SSL证书安装 (pfx文件不能直接运行时)
    .NET Core创建Worker Services
    1.初步了解IOC容器
    1.Configuration
    2.第一个Codefirst实例
    安装Mysql
    2.我的第一个小程序(获取用户信息--包括敏感信息)
    1.什么是微信小程序
    Repeater的使用
    1.MVC的初步了解
  • 原文地址:https://www.cnblogs.com/the-wang/p/6479021.html
Copyright © 2020-2023  润新知