我的问题是我不知道如何在循环中获取char。它必须是随机的,每个char必须循环10次。谢谢
public class Main { public static void main(String[] args) { field(); } public static void field() { final int WIDTH = 11; final int HEIGHT = 18; Random random = new Random(); char l = 'L'; char o = 'O'; char u = 'U'; for (int i = 0; i <= WIDTH * HEIGHT; i++) { if (i % 12 == 0) { System.out.println(); } else { System.out.print("."); } } }}
相关分类