zoukankan      html  css  js  c++  java
  • 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) {

    }

    }

  • 相关阅读:
    MySQL性能优化的最佳20+条经验
    memcached demo 应用例子
    关于 MySQL 主从复制的配置(转)
    java date 日期 利用 Calendar 实现增加一年月日时分秒
    Struts2中s:set标签和s:if标签小结
    hibernate oracle 配置序列 实现自动增长
    mysql5.1.47二进制版本的安装(转)
    Confluence3.4的安装和配置
    linux MemCache安装手册
    Java实现文件拷贝的4种方法(转)
  • 原文地址:https://www.cnblogs.com/the-wang/p/6479021.html
Copyright © 2011-2022 走看看