定义一个有关人的Person类,内含属性: String name、int age、boolean gender、int id,所有的变量必须为私有(private)。 注意:属性顺序请严格按照上述顺序依次出现。 1.编写无参构造函数: 打印"This is constructor"。 将name,age,gender,id按照name,age,gender,id格式输出 2.编写有参构造函数 依次对name,age,gender赋值。 3.覆盖toString函数: 按照格式:类名 [name=, age=, gender=, id=]输出。建议使用Eclipse自动生成.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Constructing
Contact Constructing, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack