请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

正在回答 回答被采纳积分+3

插入代码

2回答

北极玉米 2020-04-04 10:46:38

我遇到相同的问题,解决办法是引入了其他的Result,把这个import删掉重新引入就好。

1 回复 有任何疑惑可以回复我~
  • 翔仔 #1
    感谢同学的热心分享:)
    回复 有任何疑惑可以回复我~ 2020-04-06 11:28:18
翔仔 2019-04-25 00:11:11

同学,是不是没有实现Result这个类,或者没引入?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.imooc.o2o.dto;
 
/**
 * 封装json对象,所有返回结果都使用它
 */
public class Result<T> {
 
    private boolean success;// 是否成功标志
 
    private T data;// 成功时返回的数据
 
    private String errorMsg;// 错误信息
 
    private int errorCode;
 
    public Result() {
    }
 
    // 成功时的构造器
    public Result(boolean success, T data) {
        this.success = success;
        this.data = data;
    }
 
    // 错误时的构造器
    public Result(boolean success, int errorCode, String errorMsg) {
        this.success = success;
        this.errorMsg = errorMsg;
        this.errorCode = errorCode;
    }
 
    public boolean isSuccess() {
        return success;
    }
 
    public void setSuccess(boolean success) {
        this.success = success;
    }
 
    public T getData() {
        return data;
    }
 
    public void setData(T data) {
        this.data = data;
    }
 
    public String getErrorMsg() {
        return errorMsg;
    }
 
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
 
    public int getErrorCode() {
        return errorCode;
    }
 
    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
 
}


0 回复 有任何疑惑可以回复我~
  • 提问者 qq_慕无忌6378677 #1
    我写了这个类,可以在代码中Result前面写路径(private com.imooc.o2o.dto.Result<<List<ProductCategory>>),但是不可以导入这个类
    回复 有任何疑惑可以回复我~ 2019-04-25 08:56:56
  • 翔仔 回复 提问者 qq_慕无忌6378677 #2
    不可能的,在类的package引入部分添加
    import com.imooc.o2o.dto.Result;
    要么就不是一个项目或者不在同一个source folder下了,同学需要再对照下视频,对着敲一下,这个是一个比较普通简单的类调用
    回复 有任何疑惑可以回复我~ 2019-04-26 00:07:34
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号