有这样一句话“I have a dog,I love dog,dog is my friend”,请用java编写一个方法,计算上面这句话包含“dog”的个数.
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 00:26:44
有这样一句话“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”的个数.
有这样一句话“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}
\x05
\x05static int mNums;
\x05public static void getDogNums(String str) {
\x05\x05int index = str.indexOf("dog");
\x05\x05if (index != -1) {
\x05\x05\x05mNums++;
\x05\x05\x05getDogNums(str.substring(index+1));
\x05\x05}
\x05}
有这样一句话“I have a dog,I love dog,dog is my friend”,请用java编写一个方法,计算上面这句话包含“dog”的个数.
I have a dog.
I have a new dog.
Do you have a dog?肯定回答时能这样说吗?Yes,I do.或者说Yes,I have.
I have a cute dog.(改为感叹句)
I have a dog的问句是什么
翻译I have a toy dog
I have a dog.I( )name is Niuniu.快,.
I have a dog.I( ) name is Niuniu
I have a dog.So I’m its m______.
_____she have a dog?
英语翻译I have to () my dog for a walk.
May I have a hot dog?怎么回答
I have( a dog)对括号内提问
I have a dog ,it( )BOBA calls B,is called ,
I have a pet dog,what is its name?
I have a little dog.I__ name is Jim.
i have a dog.( )《it》name is wangwang.