---
title: "怎么把char 数组转换成String？"
author: "smartan"
date: "2011-10-29T00:57:18Z"
tags: []
categories: ["编程语言"]
slug: "char-string"
draft: false
lastmod: "2011-10-29T00:57:18Z"
id: 1222389
url: "https://smartan.iteye.com/blog/1222389"
---

http://smartan.iteye.com/admin

# 怎么把char 数组转换成String？

2009-2-28 23:04

提问者：[taxiskycrazy](http://passport.baidu.com/?business&aid=6&un=taxiskycrazy#2) | 悬赏分：30 | 浏览次数：3942次

```
谢谢！！！
```

问题补充：

```
还有怎么反过来把String转成char数组？ 
楼下的没有理解我的意思。 注意， 是整个char数组。
```

2009-2-28 23:47

最佳答案

```
public class Test { 

public static void main(String args[]) { 
 char[] chs = {'a','f','d'};  
 String chToStr = String.valueOf(chs);
 System.out.println(chToStr);
 String str = "fdssf";
 chs = str.toCharArray();
 for(int a = 0; a < chs.length; a ++) {
 System.out.println(chs[a]);
 }
} 
}
```