“七十三” 2023-02-05 00:43 采纳率: 44.4%
浏览 17
已结题

看下这个错误是哪里的问题

看下这报错是哪里的问题。

img

img

img

img

-----------------------------------------------------------Dormitory--------------------------------------------------------------------------------------


package com.bwcf.pojo;

import java.util.Date;

public class Dormitory {
    private Date date;
    private char dormitory;
    private int dianbiao1;
    private int dianbiao2;
    private char fangjian1;
    private char fangjian2;
    private char fangjian3;
    private char fangjian4;
    private char fangjian5;
    private char fangjian6;

    public Dormitory() {
    }

    public Dormitory(Date date, char dormitory, int dianbiao1, int dianbiao2, char fangjian1, char fangjian2, char fangjian3, char fangjian4, char fangjian5, char fangjian6) {
        this.date = date;
        this.dormitory = dormitory;
        this.dianbiao1 = dianbiao1;
        this.dianbiao2 = dianbiao2;
        this.fangjian1 = fangjian1;
        this.fangjian2 = fangjian2;
        this.fangjian3 = fangjian3;
        this.fangjian4 = fangjian4;
        this.fangjian5 = fangjian5;
        this.fangjian6 = fangjian6;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public char getDormitory() {
        return dormitory;
    }

    public void setDormitory(char dormitory) {
        this.dormitory = dormitory;
    }

    public int getDianbiao1() {
        return dianbiao1;
    }

    public void setDianbiao1(int dianbiao1) {
        this.dianbiao1 = dianbiao1;
    }

    public int getDianbiao2() {
        return dianbiao2;
    }

    public void setDianbiao2(int dianbiao2) {
        this.dianbiao2 = dianbiao2;
    }

    public char getFangjian1() {
        return fangjian1;
    }

    public void setFangjian1(char fangjian1) {
        this.fangjian1 = fangjian1;
    }

    public char getFangjian2() {
        return fangjian2;
    }

    public void setFangjian2(char fangjian2) {
        this.fangjian2 = fangjian2;
    }

    public char getFangjian3() {
        return fangjian3;
    }

    public void setFangjian3(char fangjian3) {
        this.fangjian3 = fangjian3;
    }

    public char getFangjian4() {
        return fangjian4;
    }

    public void setFangjian4(char fangjian4) {
        this.fangjian4 = fangjian4;
    }

    public char getFangjian5() {
        return fangjian5;
    }

    public void setFangjian5(char fangjian5) {
        this.fangjian5 = fangjian5;
    }

    public char getFangjian6() {
        return fangjian6;
    }

    public void setFangjian6(char fangjian6) {
        this.fangjian6 = fangjian6;
    }
}

  • 写回答

2条回答 默认 最新

  • SSS4362 2023-02-05 06:45
    关注

    java中需要使用String类型保留字符串,是不能定义成char类型
    因此把 Dormitory类中的char类型全部变成String类型,然后重新生成get set方法,更改后的代码如下所示,

    package com.bwcf.pojo;
    
    import java.util.Date;
    
    public class Dormitory {
        private Date date;
        private String dormitory;
        private int dianbiao1;
        private int dianbiao2;
        private String fangjian1;
        private String fangjian2;
        private String fangjian3;
        private String fangjian4;
        private String fangjian5;
        private String fangjian6;
    
        public Dormitory() {
        }
    
        public Dormitory(Date date, String dormitory, int dianbiao1, int dianbiao2, String fangjian1, String fangjian2, String fangjian3, String fangjian4, String fangjian5, String fangjian6) {
            this.date = date;
            this.dormitory = dormitory;
            this.dianbiao1 = dianbiao1;
            this.dianbiao2 = dianbiao2;
            this.fangjian1 = fangjian1;
            this.fangjian2 = fangjian2;
            this.fangjian3 = fangjian3;
            this.fangjian4 = fangjian4;
            this.fangjian5 = fangjian5;
            this.fangjian6 = fangjian6;
        }
    
        public Date getDate() {
            return date;
        }
    
        public void setDate(Date date) {
            this.date = date;
        }
    
        public String getDormitory() {
            return dormitory;
        }
    
        public void setDormitory(String dormitory) {
            this.dormitory = dormitory;
        }
    
        public int getDianbiao1() {
            return dianbiao1;
        }
    
        public void setDianbiao1(int dianbiao1) {
            this.dianbiao1 = dianbiao1;
        }
    
        public int getDianbiao2() {
            return dianbiao2;
        }
    
        public void setDianbiao2(int dianbiao2) {
            this.dianbiao2 = dianbiao2;
        }
    
        public String getFangjian1() {
            return fangjian1;
        }
    
        public void setFangjian1(String fangjian1) {
            this.fangjian1 = fangjian1;
        }
    
        public String getFangjian2() {
            return fangjian2;
        }
    
        public void setFangjian2(String fangjian2) {
            this.fangjian2 = fangjian2;
        }
    
        public String getFangjian3() {
            return fangjian3;
        }
    
        public void setFangjian3(String fangjian3) {
            this.fangjian3 = fangjian3;
        }
    
        public String getFangjian4() {
            return fangjian4;
        }
    
        public void setFangjian4(String fangjian4) {
            this.fangjian4 = fangjian4;
        }
    
        public String getFangjian5() {
            return fangjian5;
        }
    
        public void setFangjian5(String fangjian5) {
            this.fangjian5 = fangjian5;
        }
    
        public String getFangjian6() {
            return fangjian6;
        }
    
        public void setFangjian6(String fangjian6) {
            this.fangjian6 = fangjian6;
        }
    }
    
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月14日
  • 已采纳回答 2月6日
  • 创建了问题 2月5日

悬赏问题

  • ¥20 Apache poi使用问题
  • ¥21 matlab怎么求时域信号的二阶导数
  • ¥15 判断两个表是否完全相同
  • ¥15 java map类型数据格式,如何快速通过前缀匹配元素
  • ¥15 stc12c5a60s2、QMC5883L、LCD1602组合测量磁场所需程序
  • ¥20 Win11测试yolov4,“找不到nvcuda.dll”怎么办?
  • ¥15 simulink绘制bode图
  • ¥15 php_network_getaddresses: getaddrinfo failed: Name or service not known
  • ¥15 用msg发消息出现的问题
  • ¥15 unity3d机械臂