今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using the String class
- So let's create a few strings. I'm working in the project StringClass and I'll add code to the main method. I'll declare a string that I'll name s1. And I'll assign its value with a literal. String literals are always wrapped in double quotes. And I'll assign This is a String. Then I'll output that value using System.out.println and I'll output s1. And I'll run that code and I get what's expected. This is a String. Now I'll declare a second String but this time I'll use class constructor method syntax. And I'll pass in another String literal of This is also a String. I'll duplicate and move this line down and I'll output s2. And again I get back the expected result. So again there is no functional difference between these two syntax styles. They're both creating a String object and which you use is a matter of preference. You can also create strings by concatenating or appending values together. I'll create…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
(已锁定)
Working with object data types6 分钟 27 秒
-
(已锁定)
Using the String class5 分钟 5 秒
-
(已锁定)
Converting primitive values to strings4 分钟 15 秒
-
(已锁定)
Building a string from multiple values8 分钟 44 秒
-
(已锁定)
Comparing string values5 分钟 51 秒
-
(已锁定)
Formatting numeric values as strings4 分钟 41 秒
-
(已锁定)
Parsing string values3 分钟 13 秒
-
(已锁定)
Working with dates and times8 分钟 35 秒
-
(已锁定)
-
-
-
-
-
-
-
-