创建一个具有实例变量的类,该实例变量用于高度,重量和深度。
/**from nowjava.com - 时 代 Java**/ class Sample { int height; int weight; int depth; } public class Main { public static void main(String[] arguments) { Sample thing = new Sample(); thing.height = 72; thing.weight = 1; thing.depth = 42; System.out.println("Height: " + thing.height); System.out.println("Weight: " + thing.weight); System.out.println("Depth: " + thing.depth); } }