题目
编码
Car
类
package com.jachie.car;
/**
* 车类
* @author 哒哒哒
*
*/
public class Car {
private String color;
private String userName;
public Car() {
}
/**
* 带参构造初始化对象
* @param color
* @param userName
*/
public Car(String color, String userName) {
this.setColor(color);
this.setUserName(userName);
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
/**
* 描述语句
*/
public void use() {
System.out.println("我是机动车");
}
/**
* 重写equals,用来比较color和userName
*/
@Override
public boolean equals(Object obj) {
if(obj =&#