Miêu tả
Phương thức Double.parseDouble() là phương thức static của lớp Double để chuyển đổi String thành Double.
Cú pháp
public static double parseDouble(String s)
Ví dụ
public class HTKQ {
public static void main(String args[]) {
String s = "30.3";
double d = Double.parseDouble("30.3");
System.out.println("Gia tri cua d la: " +d);
}
}
Chạy chương trình Java trên sẽ cho kết quả:
Gia tri cua d la: 30.3

Post A Comment:
0 comments: