object to string java code example
Example 1: string to double java
public class stringtodouble {
public static void main(String args) {
String string = "1.23";
double decimal = Double.parseDouble(string);
}
}
Example 2: how to convert an object into string with different fields in java
String convertedToString = String.valueOf(Object);
String convertedToString = "" + Object;
String convertedToString = Object.toString();
Example 3: array to string java
char[] charArray = new char[] {'b','u','z','z'};
String answer = new String(charArray);