learning java Cloneable
class Address{
String Detail;
public Address(String detail){
this.Detail = detail;
}
}
class User implements Cloneable{
int age;
Address address;
public User(int age){
this.age = age;
this.address = new Address("houyang");
}
public User clone() throws CloneNotSupportedException{
return (User) super.clone();
}
}
public class CloneTest {
public static void main(String[] args) throws CloneNotSupportedException {
var c1 = new User();
var c2 = c1.clone();
System.out.println(c1 == c2);
System.out.println(c1.address == c2.address);
}
}
output:
false
true
learning java Cloneable的更多相关文章
- Learning Java language Fundamentals
Chapter 2 Learning Java language fundamentals exercises: 1.What is Unicode? Unicode is a computing ...
- Learning Java 8 Syntax (Java in a Nutshell 6th)
Java is using Unicode set Java is case sensitive Comments, C/C++ style abstract, const, final, int, ...
- blogs for learning java
曹海成的专栏 http://blog.csdn.net/caohaicheng/article/details/38071097 http://blog.csdn.net/a5489888/artic ...
- Learning Java IO indexes
I/O Streams, it simplifies I/O operations, write a whole object out to stream & read back. File ...
- Learning Java characteristics (Java in a Nutshell 6th)
Java characteristics: Java .class files are machine-independent, including the endianness. Java .cla ...
- [Java in NetBeans] Lesson 00. Getting Set-up for Learning Java
这个课程的参考视频在youtube. 主要学到的知识点有: set up needs Java SE JDK, NetBeans IDE class name should be the same l ...
- learning java 使用WatchService监控文件变化
import java.io.IOException; import java.nio.file.*; public class WatchServiceTest { public static vo ...
- learning java FileVisitor 遍丽文件及路径
import java.io.IOException; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttribut ...
- learning java Paths Path
import java.nio.file.Path; import java.nio.file.Paths; public class PathTest { public static void ma ...
随机推荐
- ColorTransform调整显示对象的颜色值
ColorTransform调整显示对象的颜色值: /** * * *------------------------------* * | *** 调整显示对象的颜色值 *** | * *----- ...
- vue页面params传值的必须传name
a.vue向b.vue传值 a.vue this.$router.push({ path: '/payType', query: { putUpList: this.putUpList, name:' ...
- Java设计模式之委派模式(Dellegate/Dispather)
概述: 委派模式有点像代理模式又有点像策略模式. 区别在于代理模式注重过程,委派模式注重结果. 生活中也有很多委派模式的例子:例如公司老板给项目经理下达任务,将任务全权交给项目经理,有项目经理根据一定 ...
- 「LibreOJ NOI Round #2」不等关系
「LibreOJ NOI Round #2」不等关系 解题思路 令 \(F(k)\) 为恰好有 \(k\) 个大于号不满足的答案,\(G(k)\) 表示钦点了 \(k\) 个大于号不满足,剩下随便填的 ...
- VS2019删除大量空白行或者缩进大量空白行
原文:VS2019删除大量空白行或者缩进大量空白行 问题描述: 在vs编辑器的代码中有时含有大量无用的空白行,我们想删除这些大量空白行或者缩进空白行. 注: 不需要将代码复制在类似word的文本编辑器 ...
- DataGrip License server
之前用 Resharper 使用 http://xidea.online 来激活 今天下载一个DataGrip 发现不能使用这个地址,不知道是被封杀了还是不能跟 Resharper 的共用 在网上找到 ...
- git push proxy 取消不掉 can not prox....
使用这个折腾了半天 git config --global --unset http.proxy git config --global --unset https.proxy 没用,原来实现项目目录 ...
- node.js开发 npm包管理工具 npm 和 cnpm区别
npm 允许用户从NPM服务器下载别人编写的第三方包到本地使用. 允许用户从NPM服务器下载并安装别人编写的命令行程序到本地使用. 允许用户将自己编写的包或命令行程序上传到NPM服务器供别人使用 np ...
- 14.1 Scroll说明和注意事项
使用scroll滚动搜索: 比如全文搜索10万条数据,不能一次全搜出来返回,太耗时了.通常是一批一批的获取结果,滚动搜索 1. 第一次搜索时,会生成这批数据的快照,下次再搜的时候,基于此快照进 ...
- 5_PHP数组_3_数组处理函数及其应用_5_数组遍历语言结构
以下为学习孔祥盛主编的<PHP编程基础与实例教程>(第二版)所做的笔记. 数组遍历语言结构 1. foreach ( array as $value ) 程序: <?php $int ...