Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Dukker Jansen   on Nov 02 In Java Category.

  
Question Answered By: Holly Brown   on Nov 02

The String.valueof(Object) method uses the output from Object.ToString()

The default behavior of this method is:

getClass().getName() + '@' + Integer.toHexString(hashCode())

All this is from the Java 1.4.2 documentation. I advise that you
download it. Sun has provided some of the most complete documentation
I have ever seen.

test code:

public class ValueTest{
int i;
String s;

ValueTest(){
i = 3;
s = "test";
}

public static void main(String[] args){
ValueTest t = new ValueTest();

System.out.println(String.valueOf(t));
System.out.println(t.toString());
}
}

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on conversion of object to string Or get search suggestion and latest updates.


Tagged: