yumo丶 2022-03-24 22:43
浏览 13
已结题

serialver命令行获取类的序列化ID,但发现路径错误,请问这是怎么回事

img

img


package javabase;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.*;

public class Employee implements Serializable {
    private String name;
    private double salary;
    private LocalDate hireDay;
    public static final int NAME_SIZE=80;
    public static final int RECORD_SIZE=100;

    public String getName()
    {
        return name;
    }
    public String getDescription()
    {
        return String.format("an employee with a salary of $%.2f",salary);
    }

    public Employee(String name,double salary,int year,int month,int day)
    {
        this.name=name;

        this.salary=salary;
        hireDay=LocalDate.of(year,month,day);
    }
    public Employee(String name)
    {
        this.name=name;
    }
    public Employee()
    {}


    public double getSalary() {
        return salary;
    }
    public LocalDate getHireDay()
    {
        return hireDay;
    }
    public void raiseSalary(double byPercent)
    {
        double raise=this.salary*byPercent/100;
        this.salary+=raise;
    }
    @Override
    public boolean equals(Object otherObject)
    {
        if(this==otherObject) {
            return true;
        }
        System.out.println("\n\n身份不同");
        if (otherObject==null) {
            return false;
        }
        if (getClass()!=otherObject.getClass()) {
            return false;
        }
        var other=(Employee)otherObject;
        return Objects.equals(name,other.name)
                &&salary==other.salary
                &&Objects.equals(hireDay,other.hireDay);
    }
    public int hashcode()
    {
        return Objects.hash(name,salary,hireDay);
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", salary=" + salary +
                ", hireDay=" + hireDay +
                '}';
    }
}

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 4月1日
    • 创建了问题 3月24日

    悬赏问题

    • ¥15 谁能解一下这个,限时1个半小时内有酬金
    • ¥15 verilog 非阻塞赋值下的移位拼接错误
    • ¥100 两个按钮控制一个LED
    • ¥15 用C语言写离散数学相关问题
    • ¥30 如何用python的GephiStreamer连接到gephi中,把Python和Gephi的具体操作过程都展示,重点回答Gephi软件的调试,以及如果代码的端口在浏览器中无法显示怎么处理
    • ¥15 ansys机翼建模肋参数
    • ¥15 Sumo软件无法运行
    • ¥15 如何在vscode里搭建stata的编辑环境?
    • ¥15 dify知识库创建问题
    • ¥15 如何用C#的chart画1000万个点不卡顿