考虑如下代码:
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" );
else
System.out.println( "Oops" );
}
}
则输出结果中有哪些?
A.Pine B.Tree C.Forest D.Oops E.无输出
答案说明:本题目答案来自网络整理或转载,最终答案请以官网为准。
答 案:ABD