Mutual conversion between an array of characters in the string method java

public  static  void main (String [] args) {
 // 1. an array of characters into a string
 // (1) in the construction of direct conversion String 
char [] Array = new new  char [] { 'A', 'B', 'C', 'D', 'E', 'F', 'G' }; 
String STR = new new String (Array); 
System.out.println (STR); 
// (2) call provides a class of String method valueOf () 
string str2 = String.valueOf (array); 
; System.out.println (str2) 
// 2 string into an array of characters.
 // toCharArray method (1) call provides a class of string () 
MSG = String "I AM A Good Boy!" ;
 char [] dest = msg.toCharArray (); 
System.out.println (Arrays,.cin.clear ()); 
}




---------------- Disclaimer: This article is CSDN blogger "Fish Alley, not with the cat," the original article, follow the undefined copyright agreement, reproduced, please attach the original source and this link statement. Original link: HTTPS: // blog.csdn.net/weixin_42153410/article/details/95494014

Guess you like

Origin www.cnblogs.com/yz123/p/11948866.html