package cn.skyfffire; /** * * @author skyffire * */ class Tree { int height; Tree() { prt("无参数构造"); } Tree(int i) { prt("创建Class Tree使用Integer参数" + i); height = i; } Tree(String s) { prt(s); } void info() { prt("Tree 值:" + height); } static void prt(String s) { System.out.println(s); } } public class Test { public static void main(String[] args) { Tree aTree = new Tree("hhh"); Tree bTree = new Tree(1); aTree.info(); bTree.info(); } }
时间: 2024-11-04 21:09:10