Question
Programming Practice Method:public static char[] firstChars(String[] arr) Creates an array containing the first character of each entry in an array of Strings. If arr is
Programming Practice
Method:public static char[] firstChars(String[] arr)
Creates an array containing the first character of each entry in an array of Strings. If arr is null, returns null. Otherwise, it returns an array containing the first letter of each entry in arr. If an entry of arr is null or empty, the corresponding entry in the output should be ?. For example firstChars({"hello","world",null,"lol","","yolo"}) should return ['h','w','?','l','?','y'].
Parameters: arr The input array.
Returns: An array containing the first character of each entry in arr if arr is not null, or null if arr is null.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started