Home Tags Posts tagged with "字符串,字符数组,转换,toCharArray"

字符串,字符数组,转换,toCharArray

package com.oracle;

import java.util.Scanner;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
String str=input.next();
char ss[] = str.toCharArray();//利用toCharArray方法转换
for (int i = 0; i < ss.length; i++) { System.out.println(ss[i]); } } }