Algorithms & Data Structures

Free Version

Upgrade subject to access all content

Easy

Choosing a Method from the Java API

ALGOR-38YZFL

You are tasked with creating a Java application that handles user input. One of the requirements of the application is that Strings inputted by users must have all leading and trailing whitespace (ie. spaces and tabs at the beginning and end of the String) removed. Rather than writing the code yourself, it is possible that a method already exists in the Java String class. When programming, it is often useful to consult the language's API (application program interface) to learn about the functionality that is built into the language. The API for a language provides a detailed listing of the classes and methods that are available.

Consult the Java API for the String class and select the method that will remove all leading and trailing whitespace. Input the name of this method.