⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex7(2).java

📁 JAVA编程思想第四版英文原版习题答案. pdf原版的
💻 JAVA
字号:
// arrays/Ex7.java
// TIJ4 Chapter Arrays, Exercise 7, page 759
// Repeat the previous exercise for a 3-D array.
import java.util.*;

public class Ex7 {
	public static BerylliumSphere[][][] sphereAM(int size1, int size2, int size3) {
		BerylliumSphere[][][] result = new BerylliumSphere[size1][size2][size3];
		for(int i = 0; i < size1; i++) {
			result[i] = new BerylliumSphere[size2][size3];
			for(int j = 0; j < size2; j++) {
				result[i][j] = new BerylliumSphere[size3];
				for(int k = 0; k < size3; k++)
					result[i][j][k] = new BerylliumSphere();
			}	
		}
		return result;
	}
	public static void main(String[] args) {
		System.out.println(Arrays.deepToString(sphereAM(2,2,2)));
		System.out.println(Arrays.deepToString(sphereAM(4,3,2)));		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -