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 ...
随机推荐
- OSGI.NET插件方式开发你的应用
之前一直从事C# WEB开发.基本都是业务开发,性能优化. 体力活占比90%吧.模块真的很多很多,每次部署经常出先各种问题.发布经常加班. 今年开始接触winform 开发.发现C# 的事件 委托 ...
- golang面对接口
- Zookeeper学习笔记(三)——java客户端代码操作
Zookeeper客户端java代码操作 上篇博客记录了shell命令操作zookeeper集群的方式,这次尝试采用java代码来操作.通过查阅API,发现并不困难. 1. 首先获得客户端与服务器的连 ...
- oracle中的CURRVAL和NEXTVAL用法
原文:https://blog.csdn.net/qianyiyiding/article/details/51592689 1.什么是sequence?其作用是什么? 在Oracle数据库中,什么 ...
- Navicat 连接mysql 报错: Authentication plugin caching_ sha2_password cannot be loaded
出现这个错误的时候, 网上的资料都是修改mysql的登录信息的, ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password ...
- django+celery+redis环境配置
celery是python开发的分布式任务调度模块 Celery本身不含消息服务,它使用第三方消息服务来传递任务,目前,celery支持的消息服务有RabbitMQ,redis甚至是数据库,redis ...
- 获取新技能 ----dispaly: tabel
刚才在总结自适应布局的时候,灵光一现,好像记得哪位大佬提过 display: tabel 这个布局,然后就去查了一下资料,进行了学习,现在简单总结一下. 说白了就是可以给HTML元素指定与表格相关的d ...
- Sbase数据库自动截断日志
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1550/html/sprocs/X3 ...
- C++中头文件与源文件的作用详解
一.C++ 编译模式 通常,在一个 C++ 程序中,只包含两类文件―― .cpp 文件和 .h 文件.其中,.cpp 文件被称作 C++ 源文件,里面放的都是 C++ 的源代码:而 .h 文件则被称作 ...
- 广联达C++面经(一站式西安) - 2019秋招
9月7号通知在广联达西安面试,早上在高新面完中兴一面就赶忙坐地铁倒公交去面试了. 一面(大概30-40min) 刚去签了一个到,就带我去面试了,在一个小型会议室,面试我的是一个女面试官(第一次碰见女 ...