Write a method called justFirstAndLast that takes a single String name and returns a new String that is only the first and last name.


You may get a name with a middle name or multiple middle names but you should ignore those.


You can assume that there will be at least two names in the given String.

Java

public String justFirstAndLast(String name)

{

}

Respuesta :

Answer:

Answer is in the attached screenshot.

Explanation:

Using regex to split a given input string via whitespace, then returns the first and last element of the array.

Ver imagen rainestormee
ACCESS MORE