Type mismatch: cannot convert from StringBuilder to String

前端 未结 3 1225
刺人心
刺人心 2021-02-02 10:10

This method returns the source of the given URL.

private static String getUrlSource(String url) {
    try {
        URL localUrl = null;
        localUrl = n         


        
3条回答
  •  星月不相逢
    2021-02-02 10:23

    I have same problem while converting StringBuilder to String, and i use above point but that's not give correct solution. using above code output comes like this

        String out=ma.toString();
    // out=[Ljava.lang.String;@41e633e0
    

    After that i find out correct solution.Think is create a new String instant inserted of StringBuilder like this..

    String out=new String(ma);
    

提交回复
热议问题