1

Hint:

The expression s.charAt(i) returns the character at position i of the string s.

Test:

String word = "Hello";
System.out.println("The word \""+word+"\" decomposes as "+Arrays.toString(decomposeString(word)));

Result:

The word "Hello" decomposes as [h, e, l, l, o]

Tamas Szoke
  • 5,426
  • 4
  • 24
  • 39
ClaraC
  • 13
  • 2

1 Answers1

1

You can use the .toCharArray() method for this.

Example

String str = "Hello";
char[] ch = str.toCharArray();

More information

Tamas Szoke
  • 5,426
  • 4
  • 24
  • 39