Miêu tả

Phương thức Float.parseFloat() là phương thức static của lớp Float để chuyển đổi String thành Float.

Cú pháp

public static int parseFloat(String s)  

Ví dụ

public class StringToFloatExample {
public static void main(String args[]) {
String s = "30.3";
float f = Float.parseFloat("30.3");
System.out.println("Gia tri cua f la: " + f);
}
}
Chạy chương trình Java trên sẽ cho kết quả:
Gia tri cua f la: 30.3

Axact

Axact

Vestibulum bibendum felis sit amet dolor auctor molestie. In dignissim eget nibh id dapibus. Fusce et suscipit orci. Aliquam sit amet urna lorem. Duis eu imperdiet nunc, non imperdiet libero.

Post A Comment:

0 comments: