课程: Java Essential Training: Syntax and Structure
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Strings
- [Tutor] Strings are not a primitive data type. And they are also not a wrapper class. A string is an object that is a sequence of characters but much like the wrapper classes, the string class provides a lot of helpful convenience methods. This string declaration is equivalent to creating an array of characters and sending it to the string constructor. Which means you can access a string just like you would in an array of characters and each character is an element in an array. Let's go through a few examples where we'll manipulate strings. In the first problem we'll write a method that counts the number of words in a string and prints each one on a new line. Here in the main method, we're making a call to count words which has not been implemented yet. And we're sending the string, I love Java. In order to split a string you have to determine a token that you like to split the string on. In our case, we have a…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。