top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the difference between toString() and valueOf() in Java?

+2 votes
190 views
What is the difference between toString() and valueOf() in Java?
posted Sep 24, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Object.toString() is used for objects.
String.valueOf(primitive) for primitives.
String.valueOf(object) returns "null" if the object is null else object.toString()

answer Sep 25, 2014 by Arun Gowda
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...