大家帮忙看看这到面试题

String str=”WeeciolGmmcc”
分别用for,while,switch3种循环写出程序,使程序能打印出WelcomeGmcic,
一个打印语句只能打印出一个字符

[code="java"] String src = "WeeciolGmmcc";

    String dest= "WelcomeGmcic";

    //Initialize the reflection map
    Map m1 = new HashMap();
    for(int i=0; i<src.length() && i<dest.length(); i++){
        m1.put(""+src.charAt(i)+i, ""+dest.charAt(i));
    }

    //by for
    for(int i=0; i<src.length(); i++){
        System.out.print(m1.get(""+src.charAt(i)+i));
    }   


    //by while
    int i = -1;
    int j = src.length();
    while(++i<j){
        System.out.print(m1.get(""+src.charAt(i)+i));
    }
    [/code]

只用Switch 做循环.真的不了解. 如果真能做出来估计也很难读懂.
Only Switch. 呵呵.

[code="java"] String a="WelcomeGmcic";
for(int i=0;i<a.length();i++){
System.out.print(a.charAt(i));
}[/code]

[code="java"]int i=0;

String a="WelcomeGmcic";

while(i<a.length()){

System.out.print(a.charAt(i));

i++;
} [/code]

有何意义?特别是Switch