无性繁殖(clone)

题目

无性繁殖(clone)


相似考题
更多“无性繁殖(clone)”相关问题
  • 第1题:

    clone()方法时,通常都有一行代码,是什么?


    在实际编程过程中,我们常常要遇到这种情况:有一个对象A,在某一时刻A中已经包含了一些有效值,此时可能会需要一个和A完全相同新对象B,并且此后对B任何改动都不会影响到A中的值,也就是说,AB是两个独立的对象,但B的初始值是由A对象确定的。Clone 有缺省行为,super.clone();他负责产生正确大小的空间并逐位复制。使用clone()来复制一个对象,clone()Object类继承。所有具有clone功能的类都有一个特性,那就是它直接或间接地实现了Cloneable接口。

    protected native Object clone() throws CloneNotSupportedException;

    可以看出它是一个protected方法,所以我们不能简单地调用它;关键字native,表明这个方法使用java以外的语言实现。

    对于object  x,

    x.clone() != x

    x.clone().getClass() == x.getClass()

    x.clone().equals(x)

    以上返回的值都为true 

    要说明的有两点:一是拷贝对象返回的是一个新对象,而不是一个引用二是拷贝对象与用new操作符返回的新对象的区别就是这个拷贝已经包含了一些原来对象的信息,而不是对象的初始信息。

    1.浅复制与深复制概念

    ⑴浅复制(浅克隆):被复制对象的所有变量都含有与原来的对象相同的值,而所有的对其他对象的引用仍然指向原来的对象。换言之,浅复制仅仅复制所考虑的对象,而不复制它所引用的对象。

    ⑵深复制(深克隆)

    被复制对象的所有变量都含有与原来的对象相同的值,除去那些引用其他对象的变量。那些引用其他对象的变量将指向被复制过的新对象,而不再是原有的那些被引用的对象。换言之,深复制把要复制的对象所引用的对象都复制了一遍。

    public class TestClone1implements Cloneable{

         int count;

         TestClone1 next;

         public TestClone1(int count) {

              this.count=count;

              if(count>0)

                   next=new TestClone1(count-1);

         }

         void add(){

              count++;

              if(next!=null)

              next.count++;

         }

         public String toString(){

              String s=String.valueOf(count)+" ";

              if(next!=null)

              s+=next.toString();

              return s;

         }

         public Object clone(){

              Object o=null;    

              try{

              o=super.clone();//如果没有实现cloneable,将会抛出CloneNotSupported异常

              }

              catch(CloneNotSupportedException e){

              System.err.println("cannot clone");

              }

              return o;

         }

         public static void main(String[] args){

              TestClone1 t=new TestClone1(1);

              System.out.println("t="+t);

              TestClone1 t1=(TestClone1)t.clone();

              System.out.println("t1="+t1);

              t.add();

              System.out.println("after added/nt t="+t+"/nt1="+t1)

        }

    }

    在这个例子中创建t相当于两个相连的TestClone1实例,而在调用了t的add方法之后,意想不到的结果出现了: 

    t=1 0

    t1=1 0

    after added

    t t=2 1

    t1=1 1

    t1也发生了改变。实际上Object.clone()进行的复制有着"bitwise"原则,也就是逐位复制。对于一个对象中定义的对象,它只是简单的复制这个对象的引用。这也就是常说的浅层拷贝(shallow copy)。想要执行深层拷贝(deep copy),只需要在TestClone1 t1=(TestClone1)t.clone();后面加上t1.next=(TestClone1)t.next.clone();就能得到:

    t=1 0

    t1=1 0

    after added

    t t=2 1

    t1=1 0

    这个正确的结果。

     

  • 第2题:

    生命科学中“克隆”(CLONE)一词的含义是:

    A.生物个体的再生
    B.生物个体的无性繁殖
    C.繁殖出的生物个体没有性别
    D.生物个体的细胞移植

    答案:A
    解析:

  • 第3题:

    Datatable对象的clone是复制表的结构和数据。()


    正确答案:错误

  • 第4题:

    无性繁殖(clone)


    正确答案: 是指生物体不经过雌雄配子的结合而实现自身复制的过程。

  • 第5题:

    无性繁殖系(Clone)


    正确答案: 从单一细胞传下来的细胞集群。

  • 第6题:

    Object类中的()方法不能被覆写。

    • A、toString()
    • B、getClass()
    • C、clone()
    • D、finalize()

    正确答案:B

  • 第7题:

    HashSet子类依靠()方法区分重复元素。

    • A、toString()、equals()
    • B、clone()、equals()
    • C、hashCode()、equals()
    • D、getClass()、clone()

    正确答案:C

  • 第8题:

    下列代码正确的是哪项?() 

    • A、 public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }
    • B、 public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }
    • C、 public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }
    • D、 public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

    正确答案:C

  • 第9题:

    克隆意为无性繁殖,克隆技术即无性繁殖技术。


    正确答案:错误

  • 第10题:

    判断题
    克隆意为无性繁殖,克隆技术即无性繁殖技术。
    A

    B


    正确答案:
    解析: 暂无解析

  • 第11题:

    名词解释题
    无性繁殖(clone)

    正确答案: 是指生物体不经过雌雄配子的结合而实现自身复制的过程。
    解析: 暂无解析

  • 第12题:

    填空题
    1903年,赫伯特·韦伯创造了“clone”这个词,他指出,同一个生物体通过无性繁殖所产生的一群生物体就是(),也就是无性繁殖系。

    正确答案: 克隆
    解析: 克隆是英文“clone”的音译。1903年,赫伯特·韦伯创造了“clone”这个词,他指出,同一个生物体通过无性繁殖所产生的一群生物体就是克隆,也就是无性繁殖系。

  • 第13题:

    Clone 和Duplicate 之间的区别是()

    A. Clone 复制出来的对象完全相同,位置也相同,Duplicate 复制出的对象位置有一点错开

    B. Clone 复制出的对象完全相同,位置有点错开,Duplicate 复制出来的对象位置也相同

    C. Clone 可以重复粘贴,其他都相同

    D. Duplicate 可以重复粘贴,其他都相同


    答案:A

  • 第14题:

    以下对CoreLDRAW的Clone命令描述不正确的是()。

    • A、Clone命令能产生源对象的派生物
    • B、Clone命令产生的派生物不能用Clone命令在产生派生物
    • C、Clone命令产生的派生物继承源对象的属性
    • D、Clone命令产生的派生物不继承源对象的属性

    正确答案:D

  • 第15题:

    Clone(克隆)和Duplicate(重制)之间的区别是什么()

    • A、Clone(克隆)复制出来的对象完全相同,位置也相同,Duplicate(重制)复制出的对象位置有一点错开
    • B、Clone(克隆)复制出的对象完全相同,位置有点错开,Duplicate(重制)复制出来的对象位置也相同
    • C、Clone(克隆)可以重复粘贴,其他都相同
    • D、Duplicate(重制)可以重复粘贴,其他都相同

    正确答案:A

  • 第16题:

    克隆是英文clone的音译,其动词含义是()。

    • A、基因复制
    • B、动物复制
    • C、有性繁殖
    • D、无性繁殖

    正确答案:D

  • 第17题:

    克隆的英文写法是什么?()

    • A、celone
    • B、cloner
    • C、clone

    正确答案:C

  • 第18题:

    如果一个对象仅仅声明实现了cloneable接口,但是不声明clone方法,外部能够调用其clone方法吗?()

    • A、 能
    • B、 不能
    • C、 不确定

    正确答案:B

  • 第19题:

    Clone animal:克隆动物


    正确答案: 指动物通过体细胞进行的无性生殖(也称无性繁殖)以及由无性生殖形成的基因型几乎完全相同的后代个体组成的群体。

  • 第20题:

    Assume that you would like to clone an existing WebLogic Domain and enable some  customizations. What scenario would you choose?()

    • A、In the Enterprise Manager, find the domain to be cloned. Choose "Clone WebLogic Domain" from the context menu. In the graphical wizard, customize and extend the domain if needed. These steps will only clone only the domain configuration. Binaries with deployments are needed  to be cloned by operation on the file system.  
    • B、In the Enterprise Manager, find the domain to be cloned. Choose "Clone WebLogic Domain"  from the context menu. In the graphical wizard, customize the domain. These steps clone the  binaries and domain configuration. If the extension is needed, perform it after cloning in the  WebLogic web-based console. 
    • C、In the Enterprise Manager, find the domain to be cloned. Choose "Clone WebLogic Domain" from the context menu. In the graphical wizard, customize and extend the domain if it is needed. These steps clone the binaries and domain configuration.  
    • D、In the Enterprise Manager, find the domain to be cloned. Choose "Clone WebLogic Domain"  from the context menu. These steps clone the binaries and domain configuration. If the customization or extension is needed, complete that after cloning in the WebLogic web-based console.  
    • E、In the file system, copy the domain structure of the configuration directory and paste it in the new location. Modify configuration files for address and port. If further customization is needed, open the WebLogic web-based console and perform these modifications.

    正确答案:C

  • 第21题:

    名词解释题
    无性系(clone)

    正确答案: 由营养体繁殖的后代。
    解析: 暂无解析

  • 第22题:

    单选题
    Assume that you would like to clone an existing WebLogic Domain and enable some  customizations. What scenario would you choose?()
    A

    In the Enterprise Manager, find the domain to be cloned. Choose Clone WebLogic Domain from the context menu. In the graphical wizard, customize and extend the domain if needed. These steps will only clone only the domain configuration. Binaries with deployments are needed  to be cloned by operation on the file system.  

    B

    In the Enterprise Manager, find the domain to be cloned. Choose Clone WebLogic Domain  from the context menu. In the graphical wizard, customize the domain. These steps clone the  binaries and domain configuration. If the extension is needed, perform it after cloning in the  WebLogic web-based console. 

    C

    In the Enterprise Manager, find the domain to be cloned. Choose Clone WebLogic Domain from the context menu. In the graphical wizard, customize and extend the domain if it is needed. These steps clone the binaries and domain configuration.  

    D

    In the Enterprise Manager, find the domain to be cloned. Choose Clone WebLogic Domain  from the context menu. These steps clone the binaries and domain configuration. If the customization or extension is needed, complete that after cloning in the WebLogic web-based console.  

    E

    In the file system, copy the domain structure of the configuration directory and paste it in the new location. Modify configuration files for address and port. If further customization is needed, open the WebLogic web-based console and perform these modifications.


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    克隆是英文clone的音译,其动词含义是()。
    A

    基因复制

    B

    动物复制

    C

    有性繁殖

    D

    无性繁殖


    正确答案: B
    解析: 暂无解析

  • 第24题:

    单选题
    如果一个对象仅仅声明实现了cloneable接口,但是不声明clone方法,外部能够调用其clone方法吗?()
    A

     能

    B

     不能

    C

     不确定


    正确答案: A
    解析: clone是Object中的保护方法,只有子类和同包才能调用