题目内容
写出程序的运行结果:class Tree{ }class Pine extends Tree{ }class Oak extends Tree{ }public class Forest {public static void main(String[ ] args){Tree tree = new Pine( );if( tree instanceof Pine)System.out.println("Pine");if( tree instanceof Tree)System.out.println("Tree");if( tree instanceof Oak)System.out.println("Oak");elseSystem.out.println("Oops");}}
查看答案
搜索结果不匹配?点我反馈