2 java
我想问你一下打印矢量数组,如下:
Vector[] routingTable = new Vector[connectivity.length];
Run Code Online (Sandbox Code Playgroud)
我尝试过这种方法,但它不适用于我,protocol.Route@c17164
当我在主要打印时,它给了我,这是代码,所以你能告诉我为什么它不能打印正确的值吗?
public String printRT(int hop)
{
String s = "";
for (int i = 0; i < conf.routingTable[hop].size(); i++)
{
s= " ROUTING TABLE " + conf.routingTable[hop].get(i);
}
return s;
}
Run Code Online (Sandbox Code Playgroud)
看起来你需要实现该toString()方法protocol.Route.
class Route {
public String toString() {
return "some string that makes sense";
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1901 次 |
| 最近记录: |