java clone方法_Java Calendar clone()方法與示例

java clone方法

日歷類clone()方法 (Calendar Class clone() method)

  • clone() method is available in java.util package.

    clone()方法在java.util包中可用。

  • clone() method is used to return the cloned object of this Calendar object.

    clone()方法用于返回此Calendar對象的克隆對象。

  • clone() method is a non-static method, it is accessible with the class object and if we try to access the method with the class name then we will get an error.

    clone()方法是一種非靜態方法,可通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • clone() method does not throw an exception at the time of cloning Calendar object.

    在克隆Calendar對象時, clone()方法不會引發異常。

Syntax:

句法:

    public Object clone();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

In both the cases, the return type of the method is Object, it returns a copy to this object.

在這兩種情況下,方法的返回類型均為Object ,它將返回此對象的副本。

Example:

例:

// Java Program to demonstrate the example of
// Object clone() method of Calendar
import java.util.*;
public class CloneOfCalendar {
public static void main(String[] args) {
// Instantiating two Calendar object
Calendar curr_ca = Calendar.getInstance();
Calendar clo_ca;
// Display current calendar
System.out.println("curr_ca: " + curr_ca.getTime());
// By using clone() method is to copy the
// object to another 
clo_ca = (Calendar) curr_ca.clone();
// Display cloned calendar
System.out.println("curr_ca.clone(): " + clo_ca.getTime());
}
}

Output

輸出量

curr_ca: Thu Jan 23 11:42:29 GMT 2020
curr_ca.clone(): Thu Jan 23 11:42:29 GMT 2020

翻譯自: https://www.includehelp.com/java/calendar-clone-method-with-example.aspx

java clone方法

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378055.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378055.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378055.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

三、Numpy數組操作

一、對圖片各個像素點的像素值進行操作 image.shape[0]:image圖像的height image.shape[1]:image圖像的width image.shape[2]:image圖像的channels import cv2 import numpy as npdef access_pixels(image):print(image.shape)height imag…

picacg服務器維護,picacg的服務器地址是什么

彈性云服務器 ECS彈性云服務器(Elastic Cloud Server)是一種可隨時自助獲取、可彈性伸縮的云服務器,幫助用戶打造可靠、安全、靈活、高效的應用環境,確保服務持久穩定運行,提升運維效率三年低至5折,多種配置可選了解詳情用戶數據注…

Redis-Sampler:深入了解你的Redis存儲

redis-sampler 是Redis作者antirez 同學開發的一個ruby 小工具,用于對Redis存儲概況進行抽樣檢測并給出分析結果。 項目地址:https://github.com/antirez/redis-sampler 使用方式: 下載源碼,執行下面命令: ./redis-sam…

二叉樹筆記(深度遍歷與廣度遍歷+13道leetcode題目(深度3道、廣度10道))

本文章為結合leetcode題目以及公眾號“代碼隨想錄”的文章所做的筆記! 感覺代碼隨想錄的題目整理真的很好,比自己盲目刷題好很多。 目錄1、二叉樹小記1、滿二叉樹與完全二叉樹2、二叉搜索樹3、平衡二叉搜索樹AVL4、二叉樹存儲方式5、二叉樹遍歷方式6、二…

ZZ的計算器

Problem Description ZZ自從上大學以來,腦容量就是以SB計算的,這個吃貨竟然連算術運算也不會了,可是當今的計算機可是非常強大的,作為ACMer, 幾個簡單的算術又算得了什么呢?可是該怎么做呢?ZZ只…

kotlin 覆蓋屬性_Kotlin程序| 方法覆蓋的示例

kotlin 覆蓋屬性方法重載 (Method Overriding) Method overriding allows derived class has the same function name and signature as the base class 方法重寫允許派生類具有與基類相同的函數名稱和簽名 By method overriding we can provide different implementation into…

對視頻中的特征顏色物體(青色水杯)進行跟蹤

方法一:目標物體白色,其余黑色 import cv2 import numpy as npdef extrace_object():capture cv2.VideoCapture("G:/Juptyer_workspace/study/data/yy.mp4")while(True):ret,frame capture.read()if retFalse:breakhsv cv2.cvtColor(frame…

Android實現號碼歸屬地查詢

我們通過發送XML訪問 WebService就可以實現號碼的歸屬地查詢,我們可以使用代理服務器提供的XML的格式進行設置,然后請求提交給服務器,服務器根據請求就會返回給一個XML,XML中就封裝了我們想要獲取的數據。 發送XML 1.通過URL封裝路…

如何從 Datagrid 中獲得單元格的內容與 使用值轉換器進行綁定數據的轉換IValueConverter...

一、如何從 Datagrid 中獲得單元格的內容 DataGrid 屬于一種 ItemsControl, 因此,它有 Items 屬性并且用ItemContainer 封裝它的 items. 但是,WPF中的DataGrid 不同于Windows Forms中的 DataGridView。 在DataGrid的Items集合中,DataGridRow…

【C++ grammar】常量、指針、Usage of using, typedef, and #define

目錄1、常量 (Constant)2、指針(Pointer)3、Usage of using, typedef, and #define1、常量 (Constant) 常量是程序中一塊數據,這個數據一旦聲明后就不能被修改了。 如果這塊數據有一個名字&am…

斯威夫特山地車_斯威夫特| 兩個數字相加的程序

斯威夫特山地車In this program, we will have an idea - how two numbers can be added and displayed as the output on the screen? 在此程序中,我們將有一個想法- 如何將兩個數字相加并顯示為屏幕上的輸出 ? Open XCode terminal and type the fol…

四、色彩空間

一、色彩空間 1、什么是色彩空間? 色彩空間是定義的顏色范圍。 2、常見的色彩空間有哪些? ①RGB ②HSV 在OpenCV中,Hue的值為0~180,之所以不是360是因為,8位存不下,故進行歸一化操作,使得H…

Oracle LOB 詳解

一. 官方說明Oracle 11gR2 文檔:LOB Storagehttp://download.oracle.com/docs/cd/E11882_01/appdev.112/e18294/adlob_tables.htm#ADLOB45267Oracle 10gR2 文檔:LOBs in Tableshttp://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_t…

FIFA的完整形式是什么?

國際足聯:國際足球聯合會 (FIFA: Federation Internationale de Football Association) FIFA is an abbreviation of the "Federation Internationale de Football Association" in French. It is also known as the International Federation of Associa…

POJ 1654 Area

題意:從原點出發,沿著8個方向走,每次走1個點格或者根號2個點格的距離,最終回到原點,求圍住的多邊形面積。分析:直接記錄所經過的點,然后計算多邊形面積。注意,不用先保存所有的點&am…

【C++ grammar】重載、內聯、變量作用域、帶默認參數的函數

目錄1、變量的作用域1. 變量的作用域分類2. Unary Scope Resolution (一元作用域解析運算符)2、重載函數3、帶有默認參數值的函數4、重載函數 VS 帶有默認參數值的函數5、內聯函數(Inline Function)1. 普通函數的優缺點2. 使用內聯函數3. 定義內聯函數4.…

五、像素運算

一、相關概念 1、算術運算 Ⅰ加減乘除 Ⅱ調節亮度 Ⅲ調整對比度 2、邏輯運算 Ⅰ與或非 Ⅱ遮罩層控制 二、圖像算術運算(加減乘除均值方差) 其中圖像的加減乘除需要保證兩張圖像的大小相同 import cv2 import numpy as npdef add(src1,src2):dst cv2.add(src1,src2)cv2.im…

創建bootstrap項目_使用Bootstrap創建第一個網頁

創建bootstrap項目使用Bootstrap創建第一個網頁 (Create First Webpage with Bootstrap) In the previous article, we learned "how to setup bootstrap?" for a web project. If you haven’t gone through that, it is recommended to read it. Now, in this art…

Chaikin Curve(球面插值)

在兩條折線間完成平滑的過渡是 用畫布做UI 或者做類似地圖編輯器一類的工作的 很常見的任務。 怎么樣化方為圓是決定工作效率的很重要的因素。(當需要編輯的曲線多起來, 復雜起來的時候,這會是件相當繁重的工作) 最容易想到的莫非…

【2020 電設G題 圖像題解】

博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。 2022.3.10新增訂閱通知 近期把此專欄設置為了付費模式,可以直接花9.9買這個專欄,買了就可以直接這個專欄的所有文章了。后…