代码改变世界

[hyddd的FindBugs分析记录][M P Dm] Method invokes toString() method on a String

2009-02-16 11:09  hyddd  阅读(1373)  评论(0编辑  收藏  举报

[M P Dm] Method invokes toString() method on a String [DM_STRING_TOSTRING]

Calling String.toString() is just a redundant operation. Just use the String.

 

对一个String对象使用了toString()方法,这种操作是多余的,完全可以去掉。

public static void main(String args[]) throws Exception{
        String str 
= "123";
        System.out.println(str.toString());
}