主要是考察对String类的了解,在其他版块看到的类似的,下面是我写的
- public class Demo6 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int num = 0;
- String str = "We are the world! We are the children.";
- String temp = str.replaceAll(" ", " ");
- num = temp.length() - str.length() + 1;
- System.out.println(num);
- }
- }
复制代码
期待更完善的代码。。。。。。。
|
|