小白求助,如何解决要求??????

图片说明

回答

public class JsonText {

public static void main(String[] args) {

Student student = new Student();

System.out.println(student);

}

}

class Student{

private String name;

private Integer age;

private char sex;

private float score;

/**

* 不建议用isPass,容易发生错误

*/

private Boolean isPass;

public Student() {

this.name = "张三";

this.age = 18;

this.sex = '男';

this.score = 66.6f;

this.isPass = Boolean.TRUE;

}

@Override

public String toString() {

return "Student{" +

"name='" + name + '\'' +

", age=" + age +

", sex=" + sex +

", score=" + score +

", isPass=" + isPass +

'}';

}

}

以上是 小白求助,如何解决要求?????? 的全部内容, 来源链接: utcz.com/a/38908.html

回到顶部