新人初学java,想请大佬们分享一下学习经验!

Write a method that searchs for a specific string within another string; the method must return true if the former exists in the latter string. For example: isSubString(“cat”, “The cat in the hat.”) is true, but isSubString(“bat”, “The cat in the hat.”) is false. Also, verify that the boundry conditions are also met.
Also, verify that the boundry conditions are also met:
isSubString(“The”, “The cat in the hat.”) is true
isSubString(“hat.”, “The cat in the hat.”) is true

Hint -
Use the charAt(int index) method in the String class to retrieve a specific character from a string; the index starts with zero.
For example. “cat”.charAt(0) is c', "cat".charAt(1) isa’, and “cat”.charAt(2) is `t’.
The length method returns the number of characters in the string; e.g. “cat”.length() is 3.

不能直接使用java里面的类包,需要自己申明方法。

你可能感兴趣的:(求助)