Difference between casting to String and String.valueOf

前端 未结 8 2142
轮回少年
轮回少年 2020-12-02 12:10

What is the difference between

Object foo = \"something\";
String bar = String.valueOf(foo);

and

Object foo = \"something\"         


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 12:31

    in String.valueOf(); string as work typecasting all the argument passed in valueof() method convert in String and just like integer.string() convert integer into string only

提交回复
热议问题