提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将数组转换为字符串
import java.util.Arrays; public class Main { public static void main(String[] args) { /** from * n o w j a v a . c o m - 时代Java **/ int[] lotto = new int[6]; for (int i = 0; i < 6; i++) lotto[i] = (int) (Math.random() * 100) + 1; System.out.println(Arrays.toString(lotto)); } }