现有:  class Tree 

题目

现有:  class Tree {  private static String tree = "tree ";  String getTree ()  {  return tree;  }       }  class Elm extends Tree {  private static String tree = "elm ";  public static void main (String  []  args)  {       new Elm() .go (new Tree())  ;      } }  void go (Tree t)  {  String  s =  t.getTree () +Elm.tree  +  tree  +   (new  Elm() .getTree ()) ;      System.out.println (s) ;}     结果为:()                 

  • A、 elm elm elm elm
  • B、 tree elm elm elm
  • C、 tree elm elm tree
  • D、 tree elm tree elm
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

现有两个类A,B,以下描述中表示B继承自A的是 ( )

A.class A extends B

B.class B implements A

C.class A implements B

D.class B extends A


正确答案:D
解析:implements是实现接口时用到的关键字,不是继承的关键字。exteends是继承用到的关键字,而它表示的意思是前者继承后者,比如选项A中的class A extends B它表示的是A继承B,选项D表示的才是B继承自A。所以本题选择D。

第2题:

考虑如下代码:

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

第3题:

现有如下包结构:com|--x||--Alpha.class||||--y||--Beta.class||--Gamma.class和类:classTest{Alphaa;Betab;Gammac;}哪三个必须加入到类Test中,以使其通过编译?()

A.packagey;

B.packagecom;

C.importcom.x.*;

D.importcom.x.y.*


参考答案:B, C, D

第4题:

Draw a labeled constituent structure tree diagram for each of the following sentences: 1) The student likes the new linguistics professor. 2) John suggested Mary take the linguistics class.
1)The student likes the new linguistics professor.
2)John suggested (that) Mary take the linguistics class.

第5题:

Which command enables RSTP on a switch?()

A. spanning-tree mode rapid-pvst

B. spanning-tree uplinkfast

C. spanning-tree backbonefast

D. spanning-tree mode mst


参考答案:A

第6题:

下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,b,c; a=(3<5); b=(a==true); System.out.println(”a=”+a+”b=+b) ; c=(b==false); System.out.printhln(”b=”+b+”c=”+c) ; } }

A.a=true b=false b=true c=false

B.a=true b=false b=true c=true

C.a=true b=true b=tree c=false

D.a=false b=false b=tree c=false


正确答案:C
解析:本题考查关系运算符<和=。题目中a=(3<5);比较3和5的大小,因为3<5,返回true给a:b=(a==true);判断a是否为真,因为a确实为真,返回true给b;c =(b==false);判断b是否为假,因为b不为假,返回false给c。最后结果a=true,b=tree, b==true,c=false,选项C正确。

第7题:

Which command enhances the 802.1D convergence time on ports that are connected to hosts?()

A. spanning-tree backbonefast

B. spanning-tree uplinkfast

C. spanning-tree portfast

D. spanning-tree cost512


参考答案:C

第8题:

现有:

classTree{

privatestaticStringtree="tree";

StringgetTree(){returntree;}

}

classElmextendsTree{

privatestaticStringtree="elm";

publicstaticvoidmain(String[]args){

newElm().go(newTree());

}

}

voidgo(Treet){

Strings=t.getTree()+Elm.tree+tree+(newElm().getTree());

System.out.println(s);}

结果为:()


参考答案:C

第9题:

There is a big tree____the house.

A.in the front of
B.in front of
C.in front
D.at class

答案:B
解析:
暂无解析

第10题:

Which two of these statements correctly describe classic PIM-SM?()

  • A、The IOS default is for a last-hop router to trigger a switch to the shortest path tree as soon as a new source is detected on the shared tree.
  • B、The IOS default is for every one of the routers on the shared tree to trigger a switch to the shortest path tree as soon as a new source is detected on the shared tree.
  • C、The default behavior of switching to the shortest path tree as soon as a new source is detected on the shared tree can be disabled by setting the value in the ip pim spt-threshold command to "infinity."
  • D、The default behavior of switching to the shortest path tree as soon as a new source is detected on the shared tree can be disabled by setting the value in the ip pim spt-threshold command to "zero."

正确答案:A,C

更多相关问题