我晕
我都给你写到一个类里了
public class StudentTest {
public static void main(String[] dfaa) {
Student s=new Student("王萍",'男',"英语",19);
s.setResult(1);
s.printDetails();
}
}
package com.bao.test;
public class Student {
private String name;
private String sex;
private int age;
private String subject;
private String mark;
public Student() {
}
public Student(String name, String sex, int age, String subject) {
super();
this.name = name;
this.sex = sex;
this.age = age;
this.subject = subject;
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
@Override
public String toString() {
return name + "," + sex + "," + age + "岁," + subject + "," + mark;
}
}
package com.bao.test;
import sun.print.resources.serviceui;
public class StudentTest {
public static void main(String args[]) {
Student student = new Student("王萍", "男", 19, "英语");
student.setMark("优秀");
System.out.println(student);
}
}
输出结果:王萍,男,19岁,英语,优秀
你又来了啊?刚才我帮你写了,可是被人抢先一步,我不帮你写了,你等那位大哥吧。
没听懂你什么意思 说清楚点嘛