有这样一句话“I have a dog,I love dog,dog is my friend”,请用java编写一个方法,计算上面这句话包含“dog”的个数.
问题描述:
有这样一句话“I have a dog,I love dog,dog is my friend”,请用java编写一个方法,计算上面这句话包含“dog”的个数.
答
咱们就用最简单最直观的吧public static void main(String[] args) {\x05\x05String content = "I have a dog,I love dog,dog is my friend";\x05\x05getDogNums(content);\x05\x05System.out.println(mNums);\x05}\...