java基础面试题之String字符串交换位置

package com.tarena.fly;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: 武健
 * \* Date: 2018/1/29
 * \* Time: 20:45
 * \* To change this template use File | Settings | File Templates.
 * \* Description:String 字符串 交换位置
 * \
 */
public class Main {
    public static void main(String[] args) {
        String a = "A";
        String b = "B";
        String temp = "";
        temp = a;
        a = b;
        b = temp;
        System.out.println(a);
        System.out.println(b);

    }
}

你可能感兴趣的:(面试)