??xml version="1.0" encoding="utf-8" standalone="yes"?>免费动漫网站在线观看,99热99re6国产在线播放,国产精品一区二区在线http://www.aygfsteel.com/skylight/coding and lifezh-cnTue, 17 Jun 2025 06:04:37 GMTTue, 17 Jun 2025 06:04:37 GMT60不能把你打倒的困难Q都能让你成?/title><link>http://www.aygfsteel.com/skylight/archive/2012/11/17/391487.html</link><dc:creator>skylight</dc:creator><author>skylight</author><pubDate>Sat, 17 Nov 2012 01:04:00 GMT</pubDate><guid>http://www.aygfsteel.com/skylight/archive/2012/11/17/391487.html</guid><wfw:comment>http://www.aygfsteel.com/skylight/comments/391487.html</wfw:comment><comments>http://www.aygfsteel.com/skylight/archive/2012/11/17/391487.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/skylight/comments/commentRss/391487.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/skylight/services/trackbacks/391487.html</trackback:ping><description><![CDATA[<div>       L提笔写点什么,却不知道该怎样记录q几个月的生zR满脑的思A却无从下W,只是感觉扑ַ作也不是自己想的那么Ҏ(gu)。看着一h工作的h都找C(jin)Q就自己没有扑ֈ合适的Q就慢慢的开始怀疑自己,对生zd未来丧失信心(j)。不q还好懂得,人最不能攑ּ的就是希望,好多事情了(jin)自己最大的努力好?br />       </div><img src ="http://www.aygfsteel.com/skylight/aggbug/391487.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/skylight/" target="_blank">skylight</a> 2012-11-17 09:04 <a href="http://www.aygfsteel.com/skylight/archive/2012/11/17/391487.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 折半查找http://www.aygfsteel.com/skylight/archive/2012/11/17/391486.htmlskylightskylightSat, 17 Nov 2012 00:30:00 GMThttp://www.aygfsteel.com/skylight/archive/2012/11/17/391486.htmlhttp://www.aygfsteel.com/skylight/comments/391486.htmlhttp://www.aygfsteel.com/skylight/archive/2012/11/17/391486.html#Feedback0http://www.aygfsteel.com/skylight/comments/commentRss/391486.htmlhttp://www.aygfsteel.com/skylight/services/trackbacks/391486.html 1package com.test2;
 2
 3public class Demo2 {
 4
 5    /**
 6     * @param args
 7     */

 8
 9    public static int search(int[] arrays, int target) {
10
11        int start = 0;
12        int end = arrays.length - 1;
13        int pos;
14        while (start <= end) {
15            pos = (start + end) / 2;
16            if (arrays[pos] == target) {
17                return pos;
18            }
 else if (arrays[pos] > target) {// 如果数组中间的数大于目标Q则end的位|变成数l中间位|-Q的位置
19                end = pos - 1;
20            }
 else {
21                start = pos + 1;// 如果数组中间的数于目标Q则start的位|变成数l中间位|?Q的位置
22            }

23        }

24        return -1// 若没有查扑ֈQ则q回Q1
25    }

26
27    public static void main(String[] args) {
28        int[] arrays = 232839592883223242323 };
29        System.out.println(search(arrays, 28));
30        System.out.println(search(arrays, 322));
31        System.out.println(search(arrays, 59));
32        System.out.println(search(arrays, 288));
33    }

34
35}

36

skylight 2012-11-17 08:30 发表评论
]]>
多线E?/title><link>http://www.aygfsteel.com/skylight/archive/2012/11/16/391437.html</link><dc:creator>skylight</dc:creator><author>skylight</author><pubDate>Fri, 16 Nov 2012 04:50:00 GMT</pubDate><guid>http://www.aygfsteel.com/skylight/archive/2012/11/16/391437.html</guid><wfw:comment>http://www.aygfsteel.com/skylight/comments/391437.html</wfw:comment><comments>http://www.aygfsteel.com/skylight/archive/2012/11/16/391437.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/skylight/comments/commentRss/391437.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/skylight/services/trackbacks/391437.html</trackback:ping><description><![CDATA[ 多线E的概念<p> 一、程序与q程</p><p>1、程序:(x)一D静(rn)态的代码?/p><p>2、进E:(x)E序的一ơ动态执行过E,它对应从代码加蝲、执行到执行完毕的一个完整过E?/p><p>3、进E也UCQ务,支持多个q程同时执行的OSpUCؓ(f)多进EOS或多dOS?/p><p> 二、进E与U程</p><p> 在一个程序内部也可以实现多个dq发执行Q其中每个Q务称为线E?/p><p> U程是比q程更小的执行单位,它是在一个进E中独立的控制流Q即E序内部的控制流?/p><p> 特点Q线E不能独立运行,必须依赖于进E,在进E中q行?/p><p> 每个E序臛_有一个线E称ZU程?/p><p> 单线E:(x)只有一条线E的q程UCؓ(f)单线E?/p><p> 多线E:(x)有不止一个线E的q程UCؓ(f)多线E?/p><p> 三、开启多U程的优点和~点</p><p> 提高界面E序响应速度。通过使用U程Q可以将需要大量时间完成的程在后台启动单独的U程完成Q提高前台界面的相应速度?/p><p> 充分利用pȝ资源Q提高效率。通过在一个程序内部同时执行多个流E,可以充分利用CPU{系l资源,从而最大限度的发挥g的性能?/p><p> 当程序中的线E数量比较多Ӟpȝ花费大量的旉q行U程的切换,q反而会(x)降低E序的执行效率。但是,相对于优势来_(d)劣势q是很有限的Q所以现在的目开发中Q多U程~程技术得C(jin)q泛的应用?/p><h2> 多线E实?/h2><p> 一、在实现U程~程Ӟ首先需要让一个类具备多线E的能力Q承ThreadcL实现Runnable接口的类具备多线E的能力Q然后创建线E对象,调用对应的启动线E方法即可实现线E编E?/p><p> 在一个程序中可以实现多个U程Q多U程~程指在同一个程序中启动?jin)两个或两个以上的线E?/p><p> 在实际实现线E时QJava语言提供?jin)三U实现方式:(x)</p><p> Q?Q承Threadc?/p><p> Q?Q实现Runnable接口</p><p> Q?Q用Timer和TimerTaskl合</p><p> 二、承ThreadU程cd现多U程<br />java.lang包中提供?jin)一个专门的U程c(ThreadQ,在该cM装?jin)许多对U程q行调度和处理的Ҏ(gu)。如果一个类l承?jin)Threadc,则该cd具备?jin)多U程的能力,可以多线E的方式执行?/p><div><div class="wmqeeuq" id="highlighter_814011" class="syntaxhighlighter java ie"><br /><div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 128, 128);"> 1</span><img id="Codehighlighter1_29_59_Open_Image" onclick="this.style.display='none'; Codehighlighter1_29_59_Open_Text.style.display='none'; Codehighlighter1_29_59_Closed_Image.style.display='inline'; Codehighlighter1_29_59_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none;" id="Codehighlighter1_29_59_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_29_59_Closed_Text.style.display='none'; Codehighlighter1_29_59_Open_Image.style.display='inline'; Codehighlighter1_29_59_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif"><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> MyThread </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> Thread</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_29_59_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_29_59_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);"> 2</span><span style="color: rgb(0, 0, 0);"><img id="Codehighlighter1_48_57_Open_Image" onclick="this.style.display='none'; Codehighlighter1_48_57_Open_Text.style.display='none'; Codehighlighter1_48_57_Closed_Image.style.display='inline'; Codehighlighter1_48_57_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_48_57_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_48_57_Closed_Text.style.display='none'; Codehighlighter1_48_57_Open_Image.style.display='inline'; Codehighlighter1_48_57_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif"></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> run()</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_48_57_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_48_57_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);"> 3</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" /><br /></span><span style="color: rgb(0, 128, 128);"> 4</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">U程?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span><span style="color: rgb(0, 128, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" /></span><span style="color: rgb(0, 0, 0);">}</span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" />}</span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" />l承Threadcd现多U程?br /></span><span style="color: rgb(0, 128, 128);"> 8</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" />MyThread tt1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> MyThread ();<br /></span><span style="color: rgb(0, 128, 128);"> 9</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">启动U程</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span><span style="color: rgb(0, 128, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" /></span><span style="color: rgb(0, 0, 0);">tt1.start();<br /></span><span style="color: rgb(0, 128, 128);">11</span><span style="color: rgb(0, 0, 0);"><img id="Codehighlighter1_132_224_Open_Image" onclick="this.style.display='none'; Codehighlighter1_132_224_Open_Text.style.display='none'; Codehighlighter1_132_224_Closed_Image.style.display='inline'; Codehighlighter1_132_224_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none;" id="Codehighlighter1_132_224_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_132_224_Closed_Text.style.display='none'; Codehighlighter1_132_224_Open_Image.style.display='inline'; Codehighlighter1_132_224_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="color: rgb(0, 0, 255);">try</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_132_224_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_132_224_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">12</span><span style="color: rgb(0, 0, 0);"><img id="Codehighlighter1_158_222_Open_Image" onclick="this.style.display='none'; Codehighlighter1_158_222_Open_Text.style.display='none'; Codehighlighter1_158_222_Closed_Image.style.display='inline'; Codehighlighter1_158_222_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_158_222_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_158_222_Closed_Text.style.display='none'; Codehighlighter1_158_222_Open_Image.style.display='inline'; Codehighlighter1_158_222_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif"></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;i </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">;i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_158_222_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_158_222_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">13</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">延时1U?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span><span style="color: rgb(0, 128, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">15</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" />Thread.sleep(</span><span style="color: rgb(0, 0, 0);">1000</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">16</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" />System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Main:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> i);<br /></span><span style="color: rgb(0, 128, 128);">17</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" /><br /></span><span style="color: rgb(0, 128, 128);">18</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />}</span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">19</span><span style="color: rgb(0, 0, 0);"><img id="Codehighlighter1_243_244_Open_Image" onclick="this.style.display='none'; Codehighlighter1_243_244_Open_Text.style.display='none'; Codehighlighter1_243_244_Closed_Image.style.display='inline'; Codehighlighter1_243_244_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none;" id="Codehighlighter1_243_244_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_243_244_Closed_Text.style.display='none'; Codehighlighter1_243_244_Open_Image.style.display='inline'; Codehighlighter1_243_244_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif">}</span></span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);">(Exception e)</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_243_244_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_243_244_Open_Text"><span style="color: rgb(0, 0, 0);">{}</span></span></div>注意Q?/div></div><p> U程的特性:(x)随机性,pȝ在执行多U程E序时只保证U程是交替执行的Q至于哪个线E先执行哪个U程后执行,则无法获得保证,需要书写专门的代码才可以保证执行的序?/p><p> 对于同一个线E类Q也可以启动多个U程</p><p> 同一个线E不能启动两ơ,</p><p> 当自定义U程中的runҎ(gu)执行完成以后Q则自定义线E自然死亡。而对于系l线E来_(d)只有当mainҎ(gu)执行l束Q而且启动的其它线E都l束以后Q才?x)结束。当pȝU程执行l束以后Q程序的执行才真正结束?/p><p> 三?实现Runable接口</p><p>a) 多线E对象实现java.lang.Runnable接口q且在该cM重写Runnable接口的runҎ(gu)?/p><p>b) 好处Q实现Runable接口的方法避免了(jin)单承的局限性?/p><p> ?Q用实现Runable接口的方式实现多U程?/p><div><div class="wmqeeuq" id="highlighter_251637" class="syntaxhighlighter java ie"><br /><div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 128, 128);">1</span><img id="Codehighlighter1_34_79_Open_Image" onclick="this.style.display='none'; Codehighlighter1_34_79_Open_Text.style.display='none'; Codehighlighter1_34_79_Closed_Image.style.display='inline'; Codehighlighter1_34_79_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none;" id="Codehighlighter1_34_79_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_34_79_Closed_Text.style.display='none'; Codehighlighter1_34_79_Open_Image.style.display='inline'; Codehighlighter1_34_79_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif"><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> MyThread2 </span><span style="color: rgb(0, 0, 255);">implements</span><span style="color: rgb(0, 0, 0);"> Runable</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_34_79_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_34_79_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">2</span><span style="color: rgb(0, 0, 0);"><img id="Codehighlighter1_53_54_Open_Image" onclick="this.style.display='none'; Codehighlighter1_53_54_Open_Text.style.display='none'; Codehighlighter1_53_54_Closed_Image.style.display='inline'; Codehighlighter1_53_54_Closed_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_53_54_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_53_54_Closed_Text.style.display='none'; Codehighlighter1_53_54_Open_Image.style.display='inline'; Codehighlighter1_53_54_Open_Text.style.display='inline';" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif"></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> run()</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_53_54_Closed_Text"><img alt="" src="http://www.aygfsteel.com/Images/dot.gif" /></span><span id="Codehighlighter1_53_54_Open_Text"><span style="color: rgb(0, 0, 0);">{}</span></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">重写Runable接口中的run()Ҏ(gu)</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">3</span><span style="color: rgb(0, 128, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" /></span><span style="color: rgb(0, 0, 0);">}</span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">4</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" />MyThread2 mt1</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> MyThread2();<br /></span><span style="color: rgb(0, 128, 128);">5</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" />Thread t1</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Thread(mt1);<br /></span><span style="color: rgb(0, 128, 128);">6</span><span style="color: rgb(0, 0, 0);"><img alt="" align="top" src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" />t1.start();</span></div>U程的生命周?/div></div><p> 一、线E的生命周期</p><p> U程是一个动态执行的q程Q它也有一个从产生到死亡的q程Q这是所谓的生命周期。一个线E在它的生命周期内有5U状态:(x)</p><p>1、新建(new ThreadQ?/p><p> 当创建Threadcȝ一个实例(对象Q时Q此U程q入新徏状态(未被启动Q?br /> 例如QThread t1=new Thread();</p><p> 2、就l(runnableQ?/p><p> U程已经被启动,正在{待被分配给C(j)PU旉片,也就是说此时U程正在qA队列中排队等候得到CPU资源。例如:(x)t1.start();</p><p> 3、运行(runningQ?/p><p> U程获得CPU资源正在执行dQrun()Ҏ(gu)Q,此时除非此线E自动放弃CPU资源或者有优先U更高的U程q入Q线E将一直运行到l束?/p><p>4、死亡(deadQ?/p><p> 当线E执行完毕或被其它线E杀死,U程p入死亡状态,q时U程不可能再q入qA状态等待执行?/p><p> 自然l止Q正常运行run()Ҏ(gu)后终?/p><p> 异常l止Q调用stop()Ҏ(gu)让一个线E终止运?/p><p>5、堵塞(blockedQ?/p><p> ׃某种原因D正在q行的线E让出CPUq暂停自q执行Q即q入堵塞状态?/p><p> 正在睡眠Q用sleep(long t) Ҏ(gu)可ɾU程q入睡眠方式。一个睡眠着的线E在指定的时间过dq入qA状态?/p><p> 正在{待Q调用wait()Ҏ(gu)。(调用motify()Ҏ(gu)回到qA状态)(j)</p><p> 被另一个线E所dQ调用suspend()Ҏ(gu)。(调用resume()Ҏ(gu)恢复Q?/p> <img src ="http://www.aygfsteel.com/skylight/aggbug/391437.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/skylight/" target="_blank">skylight</a> 2012-11-16 12:50 <a href="http://www.aygfsteel.com/skylight/archive/2012/11/16/391437.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp?ji)大内置对?/title><link>http://www.aygfsteel.com/skylight/archive/2012/11/16/391436.html</link><dc:creator>skylight</dc:creator><author>skylight</author><pubDate>Fri, 16 Nov 2012 04:45:00 GMT</pubDate><guid>http://www.aygfsteel.com/skylight/archive/2012/11/16/391436.html</guid><wfw:comment>http://www.aygfsteel.com/skylight/comments/391436.html</wfw:comment><comments>http://www.aygfsteel.com/skylight/archive/2012/11/16/391436.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/skylight/comments/commentRss/391436.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/skylight/services/trackbacks/391436.html</trackback:ping><description><![CDATA[JSP中一共预先定义了(jin)9个这L(fng)对象Q分别ؓ(f)Qrequest、response、session、application、out、pagecontext、config、page、exception<h3> 1、request对象</h3><p>request 对象?javax.servlet.httpServletRequestcd的对象?该对象代表了(jin)客户端的h信息Q主要用于接受通过HTTP协议传送到服务器的数据。(包括头信息、系l信息、请求方式以?qing)请求参数等Q。request对象的作用域Zơ请求?/p><h3>2、response对象</h3><p>response 代表的是对客L(fng)的响应,主要是将JSP容器处理q的对象传回到客L(fng)。response对象也具有作用域Q它只在JSP面内有效?/p><h3>3、session对象</h3><p>session 对象是由服务器自动创建的与用戯求相关的对象。服务器为每个用户都生成一个session对象Q用于保存该用户的信息,跟踪用户的操作状态。session对象内部使用MapcL保存数据Q因此保存数据的格式?“Key/value”?session对象的value可以使复杂的对象cdQ而不仅仅局限于字符串类型?/p><h3>4、application对象</h3><p> application 对象可将信息保存在服务器中,直到服务器关闭,否则application对象中保存的信息?x)在整个应用中都有效。与session对象相比Qapplication对象生命周期更长Q类gpȝ?#8220;全局变量”?/p><h3>5、out 对象</h3><p>out 对象用于在Web览器内输出信息Qƈ且管理应用服务器上的输出~冲区。在使用 out 对象输出数据Ӟ可以Ҏ(gu)据缓冲区q行操作Q及(qing)时清除缓冲区中的D余数据Qؓ(f)其他的输?gu)出缓冲空间。待数据输出完毕后,要及(qing)时关闭输出流?/p><h3>6、pageContext 对象</h3><p>pageContext 对象的作用是取得M范围的参敎ͼ通过它可以获?JSP面的out、request、reponse、session、application {对象。pageContext对象的创建和初始化都是由容器来完成的Q在JSP面中可以直接?pageContext对象?/p><h3>7、config 对象</h3><p>config 对象的主要作用是取得服务器的配置信息。通过 pageConext对象?getServletConfig() Ҏ(gu)可以获取一个config对象。当一个Servlet 初始化时Q容器把某些信息通过 config对象传递给q个 Servlet?开发者可以在web.xml 文g中ؓ(f)应用E序环境中的ServletE序和JSP面提供初始化参数?/p><h3>8、page 对象</h3><p>page 对象代表JSP本nQ只有在JSP面内才是合法的?page隐含对象本质上包含当?Servlet接口引用的变量,cM于Java~程中的 this 指针?/p><h3>9、exception 对象</h3><p>exception 对象的作用是昄异常信息Q只有在包含 isErrorPage="true" 的页面中才可以被使用Q在一般的JSP面中用该对象无法编译JSP文g。excepation对象和Java的所有对象一P都具有系l提供的l承l构。exception 对象几乎定义?jin)所有异常情c(din)在JavaE序中,可以使用try/catch关键字来处理异常情况Q?如果在JSP面中出现没有捕获到的异常,׃(x)生成 exception 对象Qƈ?exception 对象传送到在page指o(h)中设定的错误面中,然后在错误页面中处理相应?exception 对象?/p><img src ="http://www.aygfsteel.com/skylight/aggbug/391436.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/skylight/" target="_blank">skylight</a> 2012-11-16 12:45 <a href="http://www.aygfsteel.com/skylight/archive/2012/11/16/391436.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 抽象cM接口的区?/title><link>http://www.aygfsteel.com/skylight/archive/2012/11/14/391297.html</link><dc:creator>skylight</dc:creator><author>skylight</author><pubDate>Wed, 14 Nov 2012 02:33:00 GMT</pubDate><guid>http://www.aygfsteel.com/skylight/archive/2012/11/14/391297.html</guid><wfw:comment>http://www.aygfsteel.com/skylight/comments/391297.html</wfw:comment><comments>http://www.aygfsteel.com/skylight/archive/2012/11/14/391297.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/skylight/comments/commentRss/391297.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/skylight/services/trackbacks/391297.html</trackback:ping><description><![CDATA[<div>1.接口体现的是一U规范,而抽象类体现的是一U模板式设计?br />2.接口里只能包含抽象方法,不包含已l提供实现的Ҏ(gu)。而抽象类则完全可以包含普通方法?br />3.接口里不能定义静(rn)态方法,抽象c里面可以定义静(rn)态方法?br />4.接口里只能定义静(rn)态常量属性,不能定义普通属性。而抽象类可以定义普通属性也可以定义?rn)态常量属性?br />5.接口不包含构造器Q而抽象类可以包含构造器。构造器不是Z(jin)用来创徏对象Q而是子类调用q些构造器来完成抽象类的初始化工作?br /></div><img src ="http://www.aygfsteel.com/skylight/aggbug/391297.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/skylight/" target="_blank">skylight</a> 2012-11-14 10:33 <a href="http://www.aygfsteel.com/skylight/archive/2012/11/14/391297.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">߱</a>| <a href="http://" target="_blank">Ѯ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϻӿ</a>| <a href="http://" target="_blank">Ӳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ܿ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">޻</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">пѷ</a>| <a href="http://" target="_blank">ij</a>| <a href="http://" target="_blank">ʲ</a>| <a href="http://" target="_blank">찲</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ⶫ</a>| <a href="http://" target="_blank">»</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˫</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϴ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ļ</a>| <a href="http://" target="_blank">Ǧɽ</a>| <a href="http://" target="_blank">Ҧ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">཭</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʡ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>