Question: Create & Return an Array of Characters In the method arrayToWord ( ) take the value of userArray and return a String: Take each letter

Create & Return an Array of Characters
In the method arrayToWord() take the value of userArray and return a String:
Take each letter in userArray
Concatenate it onto a String (StringBuilder can be used here).
Return the String result from your arrayToWord() method.
Solution
Reset
Java
Sample Test Case #1
4
J
a
v
a
Execute code
STDOUT
CodingQuestion.java:13: error: cannot find symbol
char[] charArray = new char[userWord.length()];
^
symbol: variable userWord
location: class CodingQuestion
CodingQuestion.java:14: error: cannot find symbol
for (int i =0; i < userWord.length(); i++){
^
symbol: variable userWord
location: class CodingQuestion
CodingQuestion.java:15: error: cannot find symbol
charArray[i]= userWord.charAt(i);
^
symbol: variable userWord
location: class CodingQuestion
CodingQuestion.java:18: error: incompatible types: char[] cannot be converted to String
return charArray;
^
4 errors
Expected STDOUT
Your string is:
Java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!