public class Test {
private static Random r = new Random();
public static void main(String[] args) {
StringBuffer word = null;
switch(r.nextInt(2)) {
case 1: word = new StringBuffer('P');
break;
case 2: word = new StringBuffer('G');
break;
default: word = new StringBuffer('M');
break;
}
word.append('a');
word.append('i');
word.append('n');
System.out.println(word);
}
}
怎么改,能输出Main作者: 蚂蚁搬家 时间: 2013-6-25 16:53
公司面试还是黑马的面试啊?作者: liujkh123 时间: 2013-6-25 17:11
将'm'改为"M"