java.lang.Object中的错误toString()无法应用于(java.lang.String [])

时间:2015-04-07 12:21:11

标签: java tostring object-to-string

public static String[] getIncidentDescription(String strtroubleDescription) {
    String[] wfmflag = { "WFM_FLAG=TRUE" };
    String wfmflagarr = Arrays.deepToString(wfmflag);
    try {
        if (strtroubleDescription.contains("RCA:")) {
            System.out.println(strtroubleDescription);
        } else {
            strtroubleDescription = strtroubleDescription + "\n" + wfmflagarr;
        }
    } catch (Exception e) {
        logger.error("exception in getIncidentDescription..." + e);
    }
  return wfmflag;
}

正在抛出错误

  无法应用java.lang.Object中的

toString()   (java.lang.String中[])              String wfmflagarr = Arrays.toString(wfmflag);

你可以帮我解决这个问题....

1 个答案:

答案 0 :(得分:0)

String[] wfmflag = { "WFM_FLAG=TRUE" };
String wfmflagarr = Arrays.deepToString(wfmflag);

此代码对我来说很合适,请参阅result

  

[WFM_FLAG = TRUE]

如果wfmflag的值是其他任何内容,请发布您的代码或尝试关注:

String wfmflagarr = Arrays.toString(wfmflag);