Java Access String As Array Code Example

Snippet 1
  String str = "example";
char[] ch = str.toCharArray(); 
Snippet 2
  String str = "example";
char[] ch = str.toCharArray();