import java.util.Random;
public class Test{
public static void main(String[] args){
final Random r = new Random();
String ch = "aeiouycbdfgh";
int len = r.nextInt(10) + 10;
StringBuffer sb = new StringBuffer();
for (int i=0; i<len; i++){
sb.append(ch.charAt(r.nextInt(ch.length())));
}
System.out.println("String:" + sb);
System.out.println("Vowels:");
outputVowels(sb.toString());
}
public static void outputVowels(String s){
我该如何做一个for循环来输出每个不同行中的ch字符串的元音?使用For循环打印出元音
编辑:该程序是为了输出 一个 ê 我 Ø ü
'对(INT I = 0;我<5; i ++)System.out.println(ch.charAt(i));'? – Seelenvirtuose 2014-09-22 07:45:37
@Seelenvirtuose,他们已经摸索似乎的问题。他们从ch创建一个随机选择的新字符串。你可以在代码中看到他们打算在构建器中显示元音。 – ChiefTwoPencils 2014-09-22 07:48:32
来自我的投票 - 没有明显迹象表明以前的研究或努力。这是一个非常常见的编程任务 - 没有任何尝试只是很差。 – 2014-09-22 07:49:46