Java-启蒙篇

Java-启蒙篇,第1张

Java-启蒙
import com.sun.org.apache.xpath.internal.objects.XString;

import java.util.ArrayList;
import java.util.Arrays;

class student{
    private String name;
    private String classes;
    private double score;


    public student(String name, String classes, double score) {
        this.name = name;
        this.classes = classes;
        this.score = score;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getClasses() {
        return classes;
    }

    public void setClasses(String classes) {
        this.classes = classes;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }
    @Override
    public String toString() {
        return "student{" +
                "name='" + name + ''' +
                ", classes='" + classes + ''' +
                ", score=" + score +
                '}';
    }

}

public class textdome {
    public static void main(String[] args) {
        ArrayList students=new ArrayList<>();
        students.add(new student("zhansan","4",98.9));
        students.add(new student("lishi","4",98.8));
        students.add(new student("wanmazi","4",98.7));
        System.out.println(students);

    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5708249.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存