Java里面的对象克隆计算机等级考试

文章作者 100test 发表时间 2010:01:01 12:27:55
来源 100Test.Com百考试题网


  java里面的对象克隆:实际存在的对象拷贝几份!

  即将一个实际的对象进行多份拷贝

  Code highlighting produced by Actipro CodeHighlighter (freeware)

  http://www.CodeHighlighter.com/

  package xsocket.server.

  public class Test implements Cloneable {

  private String name.

  public void setName(String arg) {

  this.name = arg.

  }

  public String getName() {

  return this.name.

  }

  public Object clone() throws CloneNotSupportedException {

  return super.clone().

  }

  public static void main(String[] args) throws CloneNotSupportedException {

  Test shepp = new Test().

  shepp.setName("first").

  System.out.println(shepp.getName()).

  Test sheppclone = (Test)shepp.clone().


相关文章


计算机二级辅导:java类装载计算机等级考试
计算机二级辅导:java文本替换计算机等级考试
Java格式化输出数字计算机等级考试
java修饰符之transient计算机等级考试
Java里面的对象克隆计算机等级考试
使用response.sendRedirect的注意事项计算机等级考试
Jsp利用response.sendRedirect、cookie传参计算机等级考试
spring相关jar包简介计算机等级考试
八款Js框架介绍及比较计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛