0

(新警报)

我正在使用Java-WebSocketjson-simple

在用这个问题解决问题后如何在使用没有泛型的遗留代码时避免 Eclipse 警告put?,我现在正在尝试,但我得到了JSONObjectsendToAll obj

error: method sendToAll in class WebSocketServerBase cannot be applied 
 to given types;
                ws.sendToAll(obj);
                  ^
  required: String
  found: JSONObject
  reason: actual argument JSONObject cannot be converted to String by method 
   invocation conversion
1 error

我该怎么sendToAll obj办?

4

1 回答 1

1

obj是 a JSONObject,并且该方法需要 a String。我确定有某种方法可以将您obj转换为String识别它,但我不知道它是什么。

于 2013-07-20T23:33:39.430 回答