请写出下面程序的运行结果:
public class Test extends TT
public static void main(String args[])
Test t=new Test("Tom.");
public Test(String s)
super(S);
System.out.print("How are you");
public Test()
this("I am Jack.");
class TT
public TT()
System.out.print("Hi!");
public TT(String s)
this();
System.out.print("I am" +s);
结果:______。
参考答案:Hi! I am Tom.How are you
解析: 本题考查类的继承。(从main()方法作为程序入口,首先执行Test t=new Test("Tom.")语句,此时将调用 Test(String s)构造方法,而进入此方法后由super(s)语句来调用TT.TT(Strings),而执行this()语句将会调用TT.TT(),因此,首先由System.out.print("Hi!")语句执行输出。接下来才是System.out. print("I am"+s)语句,然后才是System.out.print("How are you"),最后程序结束。要注意区分this和super所对应的类。