maybe you don't know much (yet) but this is exactly the reason you are given assignments like this, to get to know the syntaxis and regulary used methods and to create your own implementation of them.
asking us to just give you the code would mean that in a week, you still have to say "I don't know much, which is why I need help".
try to understand what indexOf() and lastIndexOf() do:
a String - object can be seen as an array of chars, so the indexOf("substring") will give you the 'index' of the start of the given substring within the original String.
for instance:
String ob = "the first String";
System.out.println("place: " + ob.indexOf("St"));
System.out.println("place: " + ob.indexOf("notPresent"));
just run this code, see what it does, and interprete the results you get.
I take it that lastIndexOf("") will be quite clear after the answers you've already been given.
once you figured out what the code I've posted above does, it should be quite easy to write a new implementation of this methods