To String :
int i = 123;
char []c = {'h','b','c'};
String s = String.valueOf(c);
String s1 = String.valueOf(i);
like this we can covert (double,boolen,float,long,object)(char[] data,int offset,int count);
int offset from which index it has to start and count indicates length
--------------------------------------------------------------------------------------------------------
String to int
String s = "10";
int i = 123;
char []c = {'h','b','c'};
String s = String.valueOf(c);
String s1 = String.valueOf(i);
like this we can covert (double,boolen,float,long,object)(char[] data,int offset,int count);
int offset from which index it has to start and count indicates length
--------------------------------------------------------------------------------------------------------
String to int
String s = "10";
int x =Integer.parseInt(s); int b = Integer.parseInt("444",16);
here 16 is radix which converts string into integer type
-------------------------------------------------------------------------------------------------------
integer to long
integer to char
char c=(char)i;
String to Double
double d = Double.parseDouble("20");
No comments:
Post a Comment