java.util.SimpleTimeZone.clone()方法实例

Git ww9992019com 发表于 5 天前

www.9951026.com开户请拨158944523002018世界杯北京昌平区bPW4wc<div style="width:100%;float:left;" class="article-content">

                <input type="hidden" name="article_id" id="article_id" value="4180">
                <input type="hidden" name="catid" id="catid" value="0">

                <p>

<strong>clone() </strong>方法用于返回此SimpleTimeZone实例的一个副本。</p>

<h2>

声明</h2>

<p>

以下是<strong>java.util.SimpleTimeZone.clone()</strong>方法的声明。</p>

<pre class="prettyprint prettyprinted">

<span class="kwd">public</span><span class="pln"> </span><span class="typ">Object</span><span class="pln"> clone</span><span class="pun">()</span></pre>

<h2>

参数</h2>

<ul>

<li>

    <p>

        NA</p>

</li>

</ul>

<h2>

返回值</h2>

<p>

方法调用返回此实例的一个克隆。</p>

<h2>

异常</h2>

<ul>

<li>

    <p>

        NA</p>

</li>

</ul>

<h2>

例子</h2>

<p>

下面的例子显示java.util.SimpleTimeZone.clone()方法的使用</p>

<pre class="prettyprint prettyprinted">

<span class="kwd">package</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">yiibai</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.*;</span><span class="pln">

</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SimpleTimeZoneDemo</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> main</span><span class="pun">(</span><span class="pln"> </span><span class="typ">String</span><span class="pln"> args</span><span class="pun">[]</span><span class="pln"> </span><span class="pun">){</span><span class="pln">

  </span><span class="com">// create simple time zone object </span><span class="pln">

  </span><span class="typ">SimpleTimeZone</span><span class="pln"> stobj </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">SimpleTimeZone</span><span class="pun">(</span><span class="lit">720</span><span class="pun">,</span><span class="str">"India"</span><span class="pun">);</span><span class="pln">

  </span><span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Origial obj: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> stobj</span><span class="pun">);</span><span class="pln">



  </span><span class="com">// clone the object</span><span class="pln">

  </span><span class="typ">Object</span><span class="pln"> cloneObj </span><span class="pun">=</span><span class="pln"> stobj</span><span class="pun">.</span><span class="pln">clone</span><span class="pun">();</span><span class="pln">

  </span><span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Clone obj: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> cloneObj</span><span class="pun">);</span><span class="pln">

</span><span class="pun">}</span><span class="pln">

</span><span class="pun">}</span></pre>

<p>

现在编译和运行上面的代码示例,将产生以下结果。</p>

<pre class="prettyprint prettyprinted">

<span class="typ">Origial</span><span class="pln"> obj</span><span class="pun">:</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">SimpleTimeZone</span><span class="pun">[</span><span class="pln">id</span><span class="pun">=</span><span class="typ">India</span><span class="pun">,</span><span class="pln">offset</span><span class="pun">=</span><span class="lit">720</span><span class="pun">,</span><span class="pln">dstSavings</span><span class="pun">=</span><span class="lit">3600000</span><span class="pun">,</span><span class="pln">

useDaylight</span><span class="pun">=</span><span class="kwd">false</span><span class="pun">,</span><span class="pln">startYear</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startMonth</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startDay</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">

startDayOfWeek</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startTime</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startTimeMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endMonth</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">

endDay</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endDayOfWeek</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endTime</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endTimeMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">]</span><span class="pln">

</span><span class="typ">Clone</span><span class="pln"> obj</span><span class="pun">:</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">SimpleTimeZone</span><span class="pun">[</span><span class="pln">id</span><span class="pun">=</span><span class="typ">India</span><span class="pun">,</span><span class="pln">offset</span><span class="pun">=</span><span class="lit">720</span><span class="pun">,</span><span class="pln">dstSavings</span><span class="pun">=</span><span class="lit">3600000</span><span class="pun">,</span><span class="pln">

useDaylight</span><span class="pun">=</span><span class="kwd">false</span><span class="pun">,</span><span class="pln">startYear</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startMonth</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startDay</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">

startDayOfWeek</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startTime</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">startTimeMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endMonth</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">

endDay</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endDayOfWeek</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endTime</span><span class="pun">=</span><span class="lit">0</span><span class="pun">,</span><span class="pln">endTimeMode</span><span class="pun">=</span><span class="lit">0</span><span class="pun">]</span></pre>

                <br>
                <p style="text-align:center;float:left;width:100%;margin-top:24px;margin-bottom:18px;">
                        <button class="layui-btn layui-btn-danger" id="btn-reward"> ¥ 我要打赏 </button>  
                        <button class="layui-btn" id="article-perfect">
                            <i class="layui-icon layui-icon-edit"></i>教程纠错
                        </button>
                        <button class="layui-btn layui-btn-normal" id="action-collection">
                            <i class="layui-icon layui-icon-rate"></i>收藏
                        </button>
                </p>



                <div style="width:100%;margin-bottom: 16px; height: 32px;margin-top:18px;float:left;">

                    <span style="float:left;">上一篇:<a href="http://f2e.im/u/ww9992019com" title="java.util.ServiceLoader类"><i class="layui-icon"></i>
                            java.util.ServiceLoader类</a></span>
                                            <span style="float:right;">下一篇:<a href="http://f2e.im/u/ww9992019com" style="float:right;" title="下一篇:java.util.SimpleTimeZone.equals()方法实例"><i class="layui-icon"></i>
                            java.util.SimpleTimeZone.equals()方法实例</a></span>
                                            <div id="googlead" style="float:left;margin-top:8px;">
                        <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                        <!-- yiibai下方 -->
                        <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-1090193214637198" data-ad-slot="6494738921"></ins>
                        <script>
                            (adsbygoogle = window.adsbygoogle || []).push({});
                        </script>
                    </div>
                </div>

                <div style="width:100%;margin-top:18px;float:left;">


            </div>
暂无回复,说出你的观点吧
登录后即可参与回复