我的代码出现以下 Findbugs 错误,
Invocation of toString on <<Package Path>>
The code invokes toString on an array, which will generate a fairly useless
result such as [C@16f0472. Consider using Arrays.toString to convert the
array into a readable String that gives the contents of the array.
See Programming Puzzlers, chapter 3, puzzle 12.
代码:
logger.info("Adding information"+ Employee.getName()+ " "+
employeeForm.getQuestionAndAnswers());
请让我知道是什么错误。
最佳答案
正如它所说,做
myArray.toString()
会产生像 java.lang.int[]@45345262 这样无用的东西
你想用
Arrays.toString(myArray);
关于arrays - 在数组上调用 toString - FindBugs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6728730/