﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-盘古人</title><link>http://www.blogjava.net/panGu/</link><description>反省是总结过去，反悔是回到过去！
人不疯狂，枉来世！！！！！</description><language>zh-cn</language><lastBuildDate>Thu, 07 May 2026 03:19:49 GMT</lastBuildDate><pubDate>Thu, 07 May 2026 03:19:49 GMT</pubDate><ttl>60</ttl><item><title>三角形（用JAVA实现）</title><link>http://www.blogjava.net/panGu/archive/2010/11/12/337929.html</link><dc:creator>盘古人</dc:creator><author>盘古人</author><pubDate>Fri, 12 Nov 2010 09:44:00 GMT</pubDate><guid>http://www.blogjava.net/panGu/archive/2010/11/12/337929.html</guid><wfw:comment>http://www.blogjava.net/panGu/comments/337929.html</wfw:comment><comments>http://www.blogjava.net/panGu/archive/2010/11/12/337929.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/panGu/comments/commentRss/337929.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/panGu/services/trackbacks/337929.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我只是随便写的<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可供参考
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #008000">//</span><span style="color: #008000">在my.train5外面写该调试工具</span><span style="color: #008000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #000000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;my.train5.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br />
<img id="Codehighlighter1_65_392_Open_Image" onclick="this.style.display='none'; Codehighlighter1_65_392_Open_Text.style.display='none'; Codehighlighter1_65_392_Closed_Image.style.display='inline'; Codehighlighter1_65_392_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_65_392_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_65_392_Closed_Text.style.display='none'; Codehighlighter1_65_392_Open_Image.style.display='inline'; Codehighlighter1_65_392_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;Example5&nbsp;</span><span id="Codehighlighter1_65_392_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_65_392_Open_Text"><span style="color: #000000">{<br />
<img id="Codehighlighter1_107_390_Open_Image" onclick="this.style.display='none'; Codehighlighter1_107_390_Open_Text.style.display='none'; Codehighlighter1_107_390_Closed_Image.style.display='inline'; Codehighlighter1_107_390_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_107_390_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_107_390_Closed_Text.style.display='none'; Codehighlighter1_107_390_Open_Image.style.display='inline'; Codehighlighter1_107_390_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;main(String[]&nbsp;args)&nbsp;</span><span id="Codehighlighter1_107_390_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_107_390_Open_Text"><span style="color: #000000">{<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Triangle&nbsp;tr&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;Triangle(</span><span style="color: #000000">5</span><span style="color: #000000">,</span><span style="color: #000000">12</span><span style="color: #000000">,</span><span style="color: #000000">13</span><span style="color: #000000">);<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;mianJi&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">调用Triangle类中的mianJi方法求面积</span><span style="color: #008000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mianJi&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;tr.mianJi();<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">调用Triangle类中的set方法改变边长</span><span style="color: #008000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tr.set(</span><span style="color: #000000">5</span><span style="color: #000000">,&nbsp;</span><span style="color: #000000">6</span><span style="color: #000000">);<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">输出查看</span><span style="color: #008000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">面积是：</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;mianJi);<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">a&nbsp;=&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;tr.a&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">\nb&nbsp;=&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;tr.b&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">\nc&nbsp;=&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;tr.c&nbsp;);<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span></div>
三角形的类
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080">&nbsp;1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #0000ff">package</span><span style="color: #000000">&nbsp;my.train5;<br />
</span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br />
</span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;&nbsp;java.lang.Math;<br />
</span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br />
</span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img id="Codehighlighter1_67_788_Open_Image" onclick="this.style.display='none'; Codehighlighter1_67_788_Open_Text.style.display='none'; Codehighlighter1_67_788_Closed_Image.style.display='inline'; Codehighlighter1_67_788_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_67_788_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_67_788_Closed_Text.style.display='none'; Codehighlighter1_67_788_Open_Image.style.display='inline'; Codehighlighter1_67_788_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;Triangle&nbsp;</span><span id="Codehighlighter1_67_788_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_67_788_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">定义成员变量</span><span style="color: #008000"><br />
</span><span style="color: #008080">&nbsp;7</span><span style="color: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;a;<br />
</span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;b;<br />
</span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;c;<br />
</span><span style="color: #008080">10</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080">11</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">无参数的构造方法</span><span style="color: #008000"><br />
</span><span style="color: #008080">12</span><span style="color: #008000"><img id="Codehighlighter1_165_168_Open_Image" onclick="this.style.display='none'; Codehighlighter1_165_168_Open_Text.style.display='none'; Codehighlighter1_165_168_Closed_Image.style.display='inline'; Codehighlighter1_165_168_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_165_168_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_165_168_Closed_Text.style.display='none'; Codehighlighter1_165_168_Open_Image.style.display='inline'; Codehighlighter1_165_168_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;Triangle()</span><span id="Codehighlighter1_165_168_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_165_168_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">13</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">14</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080">15</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">验证的有参数的构造方法</span><span style="color: #008000"><br />
</span><span style="color: #008080">16</span><span style="color: #008000"><img id="Codehighlighter1_232_465_Open_Image" onclick="this.style.display='none'; Codehighlighter1_232_465_Open_Text.style.display='none'; Codehighlighter1_232_465_Closed_Image.style.display='inline'; Codehighlighter1_232_465_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_232_465_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_232_465_Closed_Text.style.display='none'; Codehighlighter1_232_465_Open_Image.style.display='inline'; Codehighlighter1_232_465_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;Triangle(</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;a,</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;b&nbsp;,</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;c)</span><span id="Codehighlighter1_232_465_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_232_465_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">17</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;a;<br />
</span><span style="color: #008080">18</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.b&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;b;<br />
</span><span style="color: #008080">19</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.c&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;c;<br />
</span><span style="color: #008080">20</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #000000">!</span><span style="color: #000000">(a&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">0</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">a&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;a</span><span style="color: #000000">-</span><span style="color: #000000">c&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">b&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">&nbsp;c</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;b&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;c&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;c</span><span style="color: #000000">-</span><span style="color: #000000">b&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">|</span><span style="color: #000000"><br />
</span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_422_462_Open_Image" onclick="this.style.display='none'; Codehighlighter1_422_462_Open_Text.style.display='none'; Codehighlighter1_422_462_Closed_Image.style.display='inline'; Codehighlighter1_422_462_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_422_462_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_422_462_Closed_Text.style.display='none'; Codehighlighter1_422_462_Open_Image.style.display='inline'; Codehighlighter1_422_462_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c&nbsp;</span><span style="color: #000000">-</span><span style="color: #000000">&nbsp;a&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;b&nbsp;)&nbsp;)</span><span id="Codehighlighter1_422_462_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_422_462_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">22</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">不可以构造成三角形</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">23</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">24</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">25</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080">26</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">计算面积的的方法</span><span style="color: #008000"><br />
</span><span style="color: #008080">27</span><span style="color: #008000"><img id="Codehighlighter1_504_614_Open_Image" onclick="this.style.display='none'; Codehighlighter1_504_614_Open_Text.style.display='none'; Codehighlighter1_504_614_Closed_Image.style.display='inline'; Codehighlighter1_504_614_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_504_614_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_504_614_Closed_Text.style.display='none'; Codehighlighter1_504_614_Open_Image.style.display='inline'; Codehighlighter1_504_614_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;mianJi()</span><span id="Codehighlighter1_504_614_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_504_614_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">28</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;mianJi&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;<br />
</span><span style="color: #008080">29</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;s</span><span style="color: #000000">=</span><span style="color: #000000">(a</span><span style="color: #000000">+</span><span style="color: #000000">b</span><span style="color: #000000">+</span><span style="color: #000000">c)</span><span style="color: #000000">/</span><span style="color: #000000">2</span><span style="color: #000000">;<br />
</span><span style="color: #008080">30</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mianJi&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;Math.sqrt(&nbsp;s</span><span style="color: #000000">*</span><span style="color: #000000">(s</span><span style="color: #000000">-</span><span style="color: #000000">a)</span><span style="color: #000000">*</span><span style="color: #000000">(s</span><span style="color: #000000">-</span><span style="color: #000000">b)</span><span style="color: #000000">*</span><span style="color: #000000">(s</span><span style="color: #000000">-</span><span style="color: #000000">c));<br />
</span><span style="color: #008080">31</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;mianJi;<br />
</span><span style="color: #008080">32</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">33</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080">34</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">修改边的方法</span><span style="color: #008000"><br />
</span><span style="color: #008080">35</span><span style="color: #008000"><img id="Codehighlighter1_663_784_Open_Image" onclick="this.style.display='none'; Codehighlighter1_663_784_Open_Text.style.display='none'; Codehighlighter1_663_784_Closed_Image.style.display='inline'; Codehighlighter1_663_784_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_663_784_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_663_784_Closed_Text.style.display='none'; Codehighlighter1_663_784_Open_Image.style.display='inline'; Codehighlighter1_663_784_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;set(</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;i,</span><span style="color: #0000ff">double</span><span style="color: #000000">&nbsp;j)</span><span id="Codehighlighter1_663_784_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_663_784_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">36</span><span style="color: #000000"><img id="Codehighlighter1_682_701_Open_Image" onclick="this.style.display='none'; Codehighlighter1_682_701_Open_Text.style.display='none'; Codehighlighter1_682_701_Closed_Image.style.display='inline'; Codehighlighter1_682_701_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_682_701_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_682_701_Closed_Text.style.display='none'; Codehighlighter1_682_701_Open_Image.style.display='inline'; Codehighlighter1_682_701_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;i)</span><span id="Codehighlighter1_682_701_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_682_701_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">37</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;j;<br />
</span><span style="color: #008080">38</span><span style="color: #000000"><img id="Codehighlighter1_722_741_Open_Image" onclick="this.style.display='none'; Codehighlighter1_722_741_Open_Text.style.display='none'; Codehighlighter1_722_741_Closed_Image.style.display='inline'; Codehighlighter1_722_741_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_722_741_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_722_741_Closed_Text.style.display='none'; Codehighlighter1_722_741_Open_Image.style.display='inline'; Codehighlighter1_722_741_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;i)</span><span id="Codehighlighter1_722_741_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_722_741_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">39</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;j;<br />
</span><span style="color: #008080">40</span><span style="color: #000000"><img id="Codehighlighter1_762_781_Open_Image" onclick="this.style.display='none'; Codehighlighter1_762_781_Open_Text.style.display='none'; Codehighlighter1_762_781_Closed_Image.style.display='inline'; Codehighlighter1_762_781_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_762_781_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_762_781_Closed_Text.style.display='none'; Codehighlighter1_762_781_Open_Image.style.display='inline'; Codehighlighter1_762_781_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;i)</span><span id="Codehighlighter1_762_781_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_762_781_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">41</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">this</span><span style="color: #000000">.a&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;j;<br />
</span><span style="color: #008080">42</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">43</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">44</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080">45</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">46</span><span style="color: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span></div>
<img src ="http://www.blogjava.net/panGu/aggbug/337929.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/panGu/" target="_blank">盘古人</a> 2010-11-12 17:44 <a href="http://www.blogjava.net/panGu/archive/2010/11/12/337929.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>