and string type int, double conversion type

String type is converted to an int?

String s = "123";

int i= Integer.parseInt(s);

String type converted to double?

String s = "123";

double d = Double.parseDouble(s);

Int type, Double type to a String

The first is simple, it can be a double quotes

int i = 123;

String s = i+" ";

The second use String.ValueOf () method

int i =123;

String s  = String.ValueOf(i);

 

Guess you like

Origin www.cnblogs.com/qiannianguyao/p/11809243.html