题目内容

Java兼容给定是强类型语言,它对变量类型的检查非常严格,同时也提供了一些赋值兼容原则,赋值兼容原则规定()。

A. 在继承树中允许向上赋值,既父类实例可以赋值给同类变量,还可以赋值给其子类的变量
B. 在继承树种不允许向下赋值,既子类实例不允许赋值给父类变量
C. 在继承树种不允许向下赋值,既父类实例不允许赋值给子类变量
D. 在继承树中允许向上赋值,既子类实例可以赋值给同类变量,还可以赋值给其祖先类的变量

查看答案
更多问题

考虑以下类:class Parent{String one, two;public Parent (String a, String b){one = a;two = b;}public void print( ){ System.out.println(one); }}public class Child extends Parent {public Child(String a, String b){super(a, b);}public void print( ){System.out.println(one + " to " + two );}public static void main(String[ ] args){Parent p = new Parent("south", "north");Parent t = new Child("east", "west");p.print( );t.print( );}}程序调试结果为()。

A. 在编译时出错
B. southeast
C. south to northeast to west
D. south to northeast
E. southeast to west

设有以下代码:class Base{ }public class MyCast extends Base{static boolean b1 = false;static int i = -1;static double d = 10.1;public static void main(String[] args){MyCast m = new MyCast( );Base b = new Base( );//Here}}则在 //Here处插入()代码将不出现编译和运行错误。

A. b = m;
B. m = b;
C. d = i;
D. b1 = i;

写出程序的运行结果: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");}}

吉赛利的领导品质理论提出了八种个性特征和五种激励特征,最重要的特征是()

A. 监督能力
B. 职业成就
C. 智力
D. 自信

答案查题题库