Ж/нь:
1. string to int
String Str = "203";
int a = Integer.parseInt(Str);
2. int to string
int a = 1;
String Str = Integer.toString(a);
3. string to double
String Str = "203";
double Doub= Double.parseDouble(Str);
4. double to string
double Doub= 0.203;
String Str= Double.toString(Doub);
5. string charAt
String Str = "CS203 Java";
System.out.println(Str.charAt(0)+" "+Str.charAt(1));
// Str.charAt(0) нь CS203, Str.charAt(1) Java гэсэн String-г хэвлэнэ
No comments:
Post a Comment