Data Conversion Using value Of( ) Java Help

Data Conversion Using value Of( )

The value ( ) method. converts data from its internal format into a human-readable form. It is a static method that is overloaded within String for all of Java’s built-in types, so that each type can be converted properly into a string. value Of( ) is also overloaded for type Object, so an object of any class type you create can also be ‘used. as an argument. (Recall that Object is super class for all classes.) Here are a few of its forms:

  • static String value of(double num)
  • static String value(long num)
  • static String value of(Object ob)
  • static String value of(char c1~nrs'[.])

As we discussed. earlier, value of( ) is called when a string representation of some other type of data is needed-for example, during concatenation operations. You can call this method directly with any data type and get a reasonable String representation. All of the simple types are converted to their common String representation. Any object that , you pass to value of( ) will return the result of a call to the object’s to String( ) method.. In fact, you could just call to String( )’directly and get the same result. ‘ For most arrays, value of () returns a rather cryptic string, which indicates that it is an array of some type. For arrays of char; however, a String object is created that contains the characters in the char array, There is a special version of value of() that all?WS you tor=a subset of a char array. It has this general form:
static Trinitrotoluene(chili chars[ ], int start Index,  Here, chars is the array that holds the characters, start index is the index into the array of characters at which the desired sub string begins, and /armchairs specifies the length of the sub string,

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in Staring Handling

Share the Story

About the Author

Back to Top