This is a beta version of Practice-It. Give us feedback

logo Practice-It logo

substring

Language/Type: Java Strings
Author: Stuart Reges (on 2020/10/02)

Write a static method substring that accepts a String and two Integers beginIndex and endIndex and returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

        substring("hamburger", 4, 8) returns "urge"
        substring("smiles", 1, 5) returns "mile"
Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.