JAVA中this用法小结

<div id="article\_content" class="article\_content csdn-tracking-statistics tracking-click" data-mod="popu\_519" data-dsm="post" style="overflow: hidden;"> <div class="htmledit\_views"> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我知道很多朋友都和我一样:在</span><span lang="EN-US"><font face="Times New Roman">JAVA</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序中似乎经常见到“</span><span lang="EN-US"><font face="Times New Roman">this</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”,自己也偶尔用到它,但是到底“</span><span lang="EN-US"><font face="Times New Roman">this</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”该怎么用,却心中无数!很多人一提起它,就说“当前对象”,可到底什么是当前对象,是什么当前对象,他自己也不清楚。现在让大家看一个小例子,给你分享一下</span><span lang="EN-US"><font face="Times New Roman">JAVA</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中“</span><span lang="EN-US"><font face="Times New Roman">this</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”的用法!</span></font></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">/\*\*</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;</span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">\*</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f9fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">@author</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">fengzhi</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f7f9f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">-</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">neusoft</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;</span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">\*</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;</span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">\*</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><span style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">本示例为了说明</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">this</span><span style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">的三种用法!</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;</span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f5fbf; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">\*/</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">package</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> test;</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">public</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">class</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> ThisTest {</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">private</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">int</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">=0;</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">第一个构造器:有一个</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">int</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">型形参</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>ThisTest(</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">int</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> <span style="BACKGROUND: silver; mso-highlight: silver">i</span>){</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">.</span><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">=<span style="BACKGROUND: silver; mso-highlight: silver">i</span>+1;</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">此时</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">this</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">表示引用成员变量i,而非函数参数i</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.</span><em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">out</span></em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">.println(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"Int constructor i——this.i:<span style="mso-spacerun: yes">&nbsp; </span>"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+<span style="BACKGROUND: silver; mso-highlight: silver">i</span>+</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"——"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">.</span><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.</span><em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">out</span></em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">.println(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"i-1:"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+(<span style="BACKGROUND: silver; mso-highlight: silver">i</span>-1)+</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"this.i+1:"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+(</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">.</span><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+1));</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">从两个输出结果充分证明了</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">i</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">和</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">this.i</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">是不一样的!</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//<span style="mso-tab-count: 1">&nbsp; </span></span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">第二个构造器:有一个</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">String</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">型形参</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>ThisTest(String s){</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.</span><em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">out</span></em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">.println(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"String constructor:<span style="mso-spacerun: yes">&nbsp; </span>"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+s);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//<span style="mso-tab-count: 1">&nbsp; </span></span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">第三个构造器:有一个</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">int</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">型形参和一个</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">String</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">型形参</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>ThisTest(</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">int</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> i,String s){</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">(s)</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">;</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//this</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">调用第二个构造器</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//this(i); </span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">/\*</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">此处不能用,因为其他任何方法都不能调用构造器,只有构造方法能调用他。</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">但是必须注意:就算是构造方法调用构造器,也必须为于其第一行,构造方法也只能调</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">用一个且仅一次构造器!</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">\*/</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">.</span><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">=i++;</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//this</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">以引用该类的成员变量</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.</span><em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">out</span></em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">.println(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"Int constructor:<span style="mso-spacerun: yes">&nbsp; </span>"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+i+</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"/n"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"String constructor:<span style="mso-spacerun: yes">&nbsp; </span>"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">+s);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">public</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> <span style="BACKGROUND: silver; mso-highlight: silver">ThisTest</span> increment(){</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">.</span><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">++;</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: silver; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: silver">return</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: silver; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: silver"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: yellow">this</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; BACKGROUND: silver; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-highlight: silver">;</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">返回的是当前的对象,该对象属于(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">ThisTest</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">)</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">public</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">static</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> </span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">void</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> main(String\[\] args){</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ThisTest tt0=</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">new</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> ThisTest(10);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ThisTest tt1=</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">new</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> ThisTest(</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"ok"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ThisTest tt2=</span><strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">new</span></strong><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"> ThisTest(20,</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #2a00ff; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">"ok again!"</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.</span><em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">out</span></em><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">.println(tt0.increment().increment().increment().</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">);</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//tt0.increment()</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">返回一个在</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">tt0</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">基础上i</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">++</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">的</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">ThisTest</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">对象,</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">接着又返回在上面返回的对象基础上</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">i++</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">的</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">ThisTest</span><span style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">对象!</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">}</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">运行结果:</font></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-outline-level: 1" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">Int constructor i——this.i:<span style="mso-spacerun: yes">&nbsp; </span>10——11</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">String constructor:<span style="mso-spacerun: yes">&nbsp; </span>ok</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">String constructor:<span style="mso-spacerun: yes">&nbsp; </span>ok again!</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">Int constructor:<span style="mso-spacerun: yes">&nbsp; </span>21</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">String constructor:<span style="mso-spacerun: yes">&nbsp; </span>ok again!</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">14</span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">细节问题注释已经写的比较清楚了,这里不在赘述,只是总结一下,其实</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">this</span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">主要要三种用法:</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 40.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; tab-stops: list 40.5pt" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><span style="mso-list: Ignore">1、</span></span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">表示对当前对象的引用!</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 40.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; tab-stops: list 40.5pt" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><span style="mso-list: Ignore">2、</span></span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">表示用类的成员变量,而非函数参数,注意在函数参数和成员变量同名是进行区分!其实这是第一种用法的特例,比较常用,所以那出来强调一下。</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 40.5pt; TEXT-INDENT: -19.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; tab-stops: list 40.5pt" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><span style="mso-list: Ignore">3、</span></span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">用于在构造方法中引用满足指定参数类型的构造器(其实也就是构造方法)。但是这里必须非常注意:只能引用一个构造方法且必须位于开始!</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p></o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">还有就是注意:</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">this</span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">不能用在</span><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt">static</span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">方法中!所以甚至有人给static方法的定义就是:没有this的方法!虽然夸张,但是却充分说明this不能在static方法中使用!</span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: &quot;Courier New&quot;; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p> &nbsp; </div> </div> <h3>经验:</h3></br> 不要想当然的用this去调用当前类中的私有方法,而应该用new xxx()匿名对象去调用。
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

java图形验证码生成工具类及web页面校验验证码

<divid"article\_content"class"article\_contentcsdntrackingstatisticstrackingclick"datamod"popu\_519"datadsm"post"style"overflow:hidden;"<divclass"htmledit\_vi

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )