在看Thinking in Java,有一段实在没看懂
package com.company.allAreTheObjective.Symbol;
import java.util.*;
/**
* Created by Francis on 12/05/2016.
*/
public class VowelsAndConsonants {
public static void main(String args[]){
Random rand = new Random(47);
for (int i = 0; i < 100; i++){
int c = rand.nextInt(26) + 'a';
System.out.print((char)c+","+ c +":");
switch(c){
case 'u' : System.out.println("vowel");break;
case 'w' : System.out.println("Sometimes a vowel");break;
default : System.out.println("constant");
}
}
}
}
这一段为什么输出恒为
y,121:constant
n,110:constant
z,122:constant
b,98:constant
r,114:constant
n,110:constant
y,121:constant
MMMHUHU
相关分类