课程: Java 8+ Essential Training: Syntax and Structure
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Format numeric values as strings - Java教程
课程: Java 8+ Essential Training: Syntax and Structure
Format numeric values as strings
- [Narrator] I've previously described how to convert a numeric value into a string, using the primitive data types helper classes, but you can also use a set of formatter classes that are provided with the Java RunTime to present formatted numbers and currency values. In this project, my main method declares a double value. Notice, I'm using the underscore characters to make the value more readable, but this is a simple primitive value of one million, two hundred thirty four thousand, and some pennies. So now, I'm going to format this. I'll use a class named Number Format. It's a member of the Java.txt package. As with all classes that aren't members of Java.lang or other automatic packages, I have to import the class. Intelligidea makes that easy, I just select the class from the list and the required import statement is added at the top. I'll call this number format, and I'll get its reference using a static method of the number format class. There are many different methods you…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
Declare and initialize String objects3 分钟 45 秒
-
(已锁定)
Create and concatenate String values4 分钟 34 秒
-
(已锁定)
Convert primitive values to strings5 分钟 30 秒
-
(已锁定)
Build a String from multiple values10 分钟 35 秒
-
(已锁定)
Compare String values with methods5 分钟 19 秒
-
(已锁定)
Format numeric values as strings7 分钟 2 秒
-
(已锁定)
Parse String values4 分钟 10 秒
-
(已锁定)
Challenge: A simple calculator56 秒
-
(已锁定)
Solution: A simple calculator1 分钟 26 秒
-
-
-