<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>相信明天会更好 &#187; java</title>
	<atom:link href="http://www.sunnyweiwei2008.cn/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sunnyweiwei2008.cn</link>
	<description>Tomorrow will be better</description>
	<lastBuildDate>Thu, 25 Feb 2010 08:20:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>java修改ip地址</title>
		<link>http://www.sunnyweiwei2008.cn/2009/08/java%e4%bf%ae%e6%94%b9ip%e5%9c%b0%e5%9d%80.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2009/08/java%e4%bf%ae%e6%94%b9ip%e5%9c%b0%e5%9d%80.html#comments</comments>
		<pubDate>Tue, 25 Aug 2009 01:31:16 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[.bat]]></category>
		<category><![CDATA[ip]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei2008.cn/?p=321</guid>
		<description><![CDATA[首先写一个批处理文件，然后再java中调用即可。步骤如下： 假设批处理文件为changeip.bat,内容如下： Codee#5104 @echo off netsh interface ip set address &#8220;本地连接&#8221; static 222.195.151.47 255.255.254.0 netsh interface ip set address name=&#8220;本地连接&#8221; gateway=222.195.151.254 gwmetric=0 netsh interface ip set dns name=&#8220;本地连接&#8221; source=static addr=211.64.142.6 register=PRIMARY exit   然后我们在java程序里面调用即可，调用语句如下： Java语言: Codee#5105 Process comm=Runtime.getRuntime().exec(&#8220;cmd /c start c:/changeip.bat&#8221;); 这样我们就可以实现更改本机ip了。]]></description>
			<content:encoded><![CDATA[<p>首先写一个批处理文件，然后再java中调用即可。步骤如下：</p>
<ol>
<li>假设批处理文件为changeip.bat,内容如下：</li>
</ol>
<div style="background:#fdfdfd;color:black;"><a href="http://fayaa.com/code/view/5104/">Codee#5104</a></div>
<div class="source" style="color: #000000; background-color: #cdeb8b; font-family: 'Courier New', 'Lucida Console', 'Bitstream Vera Sans Mono'; "><span style="color: #000000; ">@</span><span style="color: #0000aa; ">echo</span> <span style="color: #0000aa; ">off</span><br />
<span style="color: #000000; ">netsh interface ip </span><span style="color: #0000aa; ">set</span> <span style="color: #aa0000; ">address</span> <span style="color: #aa5500; ">&#8220;本地连接&#8221;</span><span style="color: #000000; "> static </span><span style="color: #009999; ">222</span><span style="color: #000000; ">.</span><span style="color: #009999; ">195</span><span style="color: #000000; ">.</span><span style="color: #009999; ">151</span><span style="color: #000000; ">.</span><span style="color: #009999; ">47</span> <span style="color: #009999; ">255</span><span style="color: #000000; ">.</span><span style="color: #009999; ">255</span><span style="color: #000000; ">.</span><span style="color: #009999; ">254</span><span style="color: #000000; ">.</span><span style="color: #009999; ">0</span><br />
<span style="color: #000000; ">netsh interface ip </span><span style="color: #0000aa; ">set</span> <span style="color: #aa0000; ">address</span><span style="color: #000000; "> name</span><span style="color: #000000; ">=</span><span style="color: #aa5500; ">&#8220;本地连接&#8221;</span><span style="color: #000000; "> gateway</span><span style="color: #000000; ">=</span><span style="color: #009999; ">222</span><span style="color: #000000; ">.</span><span style="color: #009999; ">195</span><span style="color: #000000; ">.</span><span style="color: #009999; ">151</span><span style="color: #000000; ">.</span><span style="color: #009999; ">254</span><span style="color: #000000; "> gwmetric</span><span style="color: #000000; ">=</span><span style="color: #009999; ">0</span><br />
<span style="color: #000000; ">netsh interface ip </span><span style="color: #0000aa; ">set</span> <span style="color: #aa0000; ">dns</span><span style="color: #000000; "> name</span><span style="color: #000000; ">=</span><span style="color: #aa5500; ">&#8220;本地连接&#8221;</span><span style="color: #000000; "> source</span><span style="color: #000000; ">=</span><span style="color: #000000; ">static addr</span><span style="color: #000000; ">=</span><span style="color: #009999; ">211</span><span style="color: #000000; ">.</span><span style="color: #009999; ">64</span><span style="color: #000000; ">.</span><span style="color: #009999; ">142</span><span style="color: #000000; ">.</span><span style="color: #009999; ">6</span><span style="color: #000000; "> register</span><span style="color: #000000; ">=</span><span style="color: #000000; ">PRIMARY</span><br />
<span style="color: #000000; ">exit</span></div>
<p>  然后我们在java程序里面调用即可，调用语句如下：</p>
<ol>
<div style="background:#fdfdfd;color:black;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://fayaa.com/code/view/5105/">Codee#5105</a></div>
<div class="source" style="font-family: 'Courier New', 'Lucida Console', 'Bitstream Vera Sans Mono'; color: #000000; background-color: #cdeb8b; "><span style="color: #000000; ">Process</span> <span style="color: #000000; ">comm</span><span style="color: #000000; ">=</span><span style="color: #000000; ">Runtime</span><span style="color: #000000; ">.</span><span style="color: #1e90ff; ">getRuntime</span><span style="color: #000000; ">().</span><span style="color: #1e90ff; ">exec</span>(<span style="color: #aa5500; ">&#8220;cmd /c start c:/changeip.bat&#8221;</span>);</div>
</ol>
<p>这样我们就可以实现更改本机ip了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2009/08/java%e4%bf%ae%e6%94%b9ip%e5%9c%b0%e5%9d%80.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>java获取系统时间并转化为&#8221;-&#8221;相连接的形式</title>
		<link>http://www.sunnyweiwei2008.cn/2009/02/systemtime-java.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2009/02/systemtime-java.html#comments</comments>
		<pubDate>Wed, 18 Feb 2009 12:12:53 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[系统时间]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=155</guid>
		<description><![CDATA[Calendar c=Calendar.getInstance(); String s=c.get(Calendar.YEAR)+&#8221;-&#8221;+(c.get(Calendar.MONTH)+1)+&#8221;-&#8221;+c.get(Calendar.DATE)+&#8221;-&#8221;+c.get(Calendar.HOUR_OF_DAY)+&#8221;:&#8221;+c.get(Calendar.MINUTE+&#8221;:&#8221;+c.get(Calendar.SECOND));]]></description>
			<content:encoded><![CDATA[<p><span> </span>Calendar c=Calendar.getInstance();</p>
<p><span> </span>String s=c.get(Calendar.YEAR)+&#8221;-&#8221;+(c.get(Calendar.MONTH)+1)+&#8221;-&#8221;+c.get(Calendar.DATE)+&#8221;-&#8221;+c.get(Calendar.HOUR_OF_DAY)+&#8221;:&#8221;+c.get(Calendar.MINUTE+&#8221;:&#8221;+c.get(Calendar.SECOND));</p>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2009/02/systemtime-java.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>java中的数据存储细节</title>
		<link>http://www.sunnyweiwei2008.cn/2008/12/date-save.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/12/date-save.html#comments</comments>
		<pubDate>Tue, 02 Dec 2008 06:53:50 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[堆内存]]></category>
		<category><![CDATA[数据存储]]></category>
		<category><![CDATA[栈内存]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=116</guid>
		<description><![CDATA[计算机的物理内存在os和jvm中使用时分为堆内存和栈内存两种方式： 堆内存：（Heap Memory）由所有的应用程序公用，存储空间不连续，存储容量大。在堆内存中分配存储空间和进行存取操作速度慢。 栈内存（Stack Heap）由特定的应用程序专用，存储空间是连续的，以栈的方式（后进先出）进行管理，存储容量小，但是访问速度快。 java程序运行时，局部变量是保存在栈内存中，而对象及其成员变量保存在堆内存中。]]></description>
			<content:encoded><![CDATA[<p>计算机的物理内存在os和jvm中使用时分为堆内存和栈内存两种方式：</p>
<ul>
<li>堆内存：（Heap Memory）由所有的应用程序公用，存储空间不连续，存储容量大。在堆内存中分配存储空间和进行存取操作速度慢。</li>
<li>栈内存（Stack Heap）由特定的应用程序专用，存储空间是连续的，以栈的方式（后进先出）进行管理，存储容量小，但是访问速度快。</li>
</ul>
<p>java程序运行时，局部变量是保存在栈内存中，而对象及其成员变量保存在堆内存中。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/12/date-save.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>java中的滚动条和菜单</title>
		<link>http://www.sunnyweiwei2008.cn/2008/11/scrollandbar.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/11/scrollandbar.html#comments</comments>
		<pubDate>Tue, 18 Nov 2008 14:04:54 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[JMenu]]></category>
		<category><![CDATA[JScrollBar]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=95</guid>
		<description><![CDATA[滚动条（JScrollBar) 因为滚动条要实现能够左右,上下移动.所以就要有相应的监听器,所以在当图形界面中有滚动条时,不要忘了在程序开头加上import java.awt.event.*；JScrollBar对象会产生一个AdjustmentEvent事件，所以要在程序中继承接口AdjustmentListener其监听器方法是adjustmentValueChanged(AdjustmentEvent e). 其属性有：orientation指定滚动条的方向 jsbHort=new JScrollBar(); jsbVert=new JScrollBar(); jsbHort.setOrientation(Adjustable.HORIZONTAL);//设置为水平滚动条 jsbVert.setOrientation(Adjustable.VERTICAL);//为垂直滚动条 jsbHort.addAdjustmentListener(this);//加上监听器 jsbVert.addAdjustmentListener(this);//同上 double value=jsbVert.getValue();//获得滚动条的当前水平滚动值 double maximumValue=jsbVert.getMaximum();//获得滚动条水平滚动最大值 菜单（JMenu） 它要实现的监听器接口是ActionListener,监听器方法为actionPerformed(ActionEvent e) Java语言: 创建菜单 JFrame frame=new JFrame(); JMenuBar jmb=new JMenuBar();//新建一个菜单栏 frame.setJMenuBar(jmb);//把菜单栏与框架产生关联 JMenu fileMenu=new JMenu(&#8220;File&#8221;);//新建一个一个菜单File jmb.add(fileMenu);//把菜单项加到菜单栏中 fileMenu.add(new JMenuItem(&#8220;new&#8221;));//给File菜单添加菜单项 fileMenu.addSeperator();//添加一条分隔线 具体的可以查看相应的API]]></description>
			<content:encoded><![CDATA[<ul>
<li>滚动条（JScrollBar)</li>
</ul>
<ol>
<li> 因为滚动条要实现能够左右,上下移动.所以就要有相应的监听器,所以在当图形界面中有滚动条时,不要忘了在程序开头加上import java.awt.event.*；JScrollBar对象会产生一个AdjustmentEvent事件，所以要在程序中继承接口AdjustmentListener其监听器方法是adjustmentValueChanged(AdjustmentEvent e).</li>
<li>其属性有：orientation指定滚动条的方向</li>
</ol>
<p>jsbHort=new JScrollBar();<br />
jsbVert=new JScrollBar();<br />
jsbHort.setOrientation(Adjustable.HORIZONTAL);//设置为水平滚动条<br />
jsbVert.setOrientation(Adjustable.VERTICAL);//为垂直滚动条</p>
<p>jsbHort.addAdjustmentListener(this);//加上监听器<br />
jsbVert.addAdjustmentListener(this);//同上</p>
<p>double value=jsbVert.getValue();//获得滚动条的当前水平滚动值</p>
<p>double maximumValue=jsbVert.getMaximum();//获得滚动条水平滚动最大值</p>
<p><span id="more-95"></span></p>
<ul>
<li>菜单（JMenu）</li>
</ul>
<p>它要实现的监听器接口是ActionListener,监听器方法为actionPerformed(ActionEvent e)</p>
<div style="background: #fdfdfd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://www.fayaa.com/code/view//">创建菜单</a></div>
<div class="source" style="font-family: ">JFrame frame<span style="color: #666666;">=</span><span style="font-weight: bold; color: #007020;">new</span> JFrame<span style="color: #666666;">();</span><br />
JMenuBar jmb<span style="color: #666666;">=</span><span style="font-weight: bold; color: #007020;">new</span> JMenuBar<span style="color: #666666;">();</span><span style="font-style: italic; color: #60a0b0;">//新建一个菜单栏</span><br />
frame<span style="color: #666666;">.</span><span style="color: #4070a0;">setJMenuBar</span><span style="color: #666666;">(</span>jmb<span style="color: #666666;">);</span><span style="font-style: italic; color: #60a0b0;">//把菜单栏与框架产生关联</span><br />
JMenu fileMenu<span style="color: #666666;">=</span><span style="font-weight: bold; color: #007020;">new</span> JMenu<span style="color: #666666;">(</span><span style="color: #4070a0;">&#8220;File&#8221;</span><span style="color: #666666;">);</span><span style="font-style: italic; color: #60a0b0;">//新建一个一个菜单File</span><br />
jmb<span style="color: #666666;">.</span><span style="color: #4070a0;">add</span><span style="color: #666666;">(</span>fileMenu<span style="color: #666666;">);</span><span style="font-style: italic; color: #60a0b0;">//把菜单项加到菜单栏中</span><br />
fileMenu<span style="color: #666666;">.</span><span style="color: #4070a0;">add</span><span style="color: #666666;">(</span><span style="font-weight: bold; color: #007020;">new</span> JMenuItem<span style="color: #666666;">(</span><span style="color: #4070a0;">&#8220;new&#8221;</span><span style="color: #666666;">));</span><span style="font-style: italic; color: #60a0b0;">//给File菜单添加菜单项</span><br />
fileMenu<span style="color: #666666;">.</span><span style="color: #4070a0;">addSeperator</span><span style="color: #666666;">();</span><span style="font-style: italic; color: #60a0b0;">//添加一条分隔线</span></div>
<p>具体的可以查看相应的API</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/11/scrollandbar.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>只言片语&#8211;java中的文件读写</title>
		<link>http://www.sunnyweiwei2008.cn/2008/11/fileio.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/11/fileio.html#comments</comments>
		<pubDate>Sun, 16 Nov 2008 14:19:25 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[InputStream]]></category>
		<category><![CDATA[OutPutStream]]></category>
		<category><![CDATA[Reader]]></category>
		<category><![CDATA[Writer]]></category>
		<category><![CDATA[文件读写]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=93</guid>
		<description><![CDATA[在文件读写部分中,我们如果要读取格式化数据.可以使用DataInputStream,它是以俄国面向字节的I/O类,因此我们必须使用InputStream类,而不是Reader类,当然我们可以用InputStream以字节的形式读取任何数据(例如一个文件),不过.在这里我们用的是字符串,为了能将字符串转化成适用于ByteArrayInputStream的字节数组,String包含了一个可以将字符串转化为字节数组的getByte（）方法。所以我们就持有了一个可传递给DataInputStream的InputStream。 try{ DataInputStream in3=new DataInputStream(new ByteArrayInputStream(s2.getBytes()));//s2是String类型的 System.out.print((char) in3.readByte()); }cacth(EOFException e) {System.out.println(&#8220;End of stream&#8221;);//此时我们是通过捕获异常来检测输入的末尾，但是使用异常进行流控制，被认为是对异常特性的错误使用 } 我们还可以通过available()方法查看还有多少可供存取的字符。例如 Java语言: available()判断文件是否是否到末尾 import java.io.*; public class TestEOF{ public static void main(String[] args) throws IOException { DataInputStream in=new DateInputSteam(new BufferedInputStream(new FileInputStream(&#8220;TestEOF.java&#8221;))); while(in.available()!=0) { System.out.print((char)in.readByte()); } } } 关于文件输出： 首先创建与制定文件连接的FileWriter，但是为了显著增加I/O操作的性能，我们通常会用BufferedWriter将其包装起来用一缓冲输出，然后为了格式化，将它转化成PrintWriter。按照这种方式创建数据文件可作为普通文本文件读取。 标准I/O： JAVA提供了System.out,System.in,System.err.其中System.out已经事先被包装成了printStream对象。System.err同样也是PrintStream对象。但是System.in却是一个没有包装过的未经加工的InputStream，这就意味着我们可以立即使用System.out和System.err,但是在读取System.in之前必须对其进行包装。 通常我们会用readLine()一次一行的读取输入，因此我们会将Sysetem.in包装成BufferReader来使用。所以我们必须用InputStreamReader把System.in转化成Reader 注：readLine()会抛出IOException所以要注意声明。 将System.out转化成PrintWriter System.out是一个PrintStream而PrintStream是一个OutputStream。PrintWriter有一个可以接受OutputStream作为参数的构造器。 PrintWriter out=new PrintWriter(System.out,true);]]></description>
			<content:encoded><![CDATA[<p>在文件读写部分中,我们如果要读取格式化数据.可以使用DataInputStream,它是以俄国面向<span style="color: #ff0000;">字节</span>的I/O类,因此我们必须使用InputStream类,而不是Reader类,当然我们可以用InputStream以字节的形式读取任何数据(例如一个文件),不过.在这里我们用的是字符串,为了能将字符串转化成适用于ByteArrayInputStream的字节数组,String包含了一个可以将字符串转化为字节数组的getByte（）方法。所以我们就持有了一个可传递给DataInputStream的InputStream。</p>
<p>try{</p>
<p>DataInputStream in3=new DataInputStream(new ByteArrayInputStream(s2.getBytes()));//s2是String类型的</p>
<p>System.out.print((char) in3.readByte());</p>
<p>}cacth(EOFException e)</p>
<p>{System.out.println(&#8220;End of stream&#8221;);//<span style="color: #ff0000;">此时我们是通过捕获异常来检测输入的末尾，但是使用异常进行流控制，被认为是对异常特性的错误使用</span></p>
<p>}</p>
<p><span id="more-93"></span></p>
<p>我们还可以通过available()方法查看还有多少可供存取的字符。例如</p>
<div style="background: #fdfdfd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://www.fayaa.com/code/view//">available()判断文件是否是否到末尾</a></div>
<div class="source" style="font-family: ">import <span style="font-weight: bold; color: #0e84b5;">java.io.*</span><span style="color: #666666;">;</span><br />
<span style="font-weight: bold; color: #007020;">public</span> <span style="font-weight: bold; color: #007020;">class</span> <span style="font-weight: bold; color: #0e84b5;">TestEOF</span><span style="color: #666666;">{</span><br />
<span style="font-weight: bold; color: #007020;">public</span> <span style="font-weight: bold; color: #007020;">static</span> <span style="color: #902000;">void</span> <span style="color: #06287e;">main</span><span style="color: #666666;">(</span>String<span style="color: #666666;">[]</span> args<span style="color: #666666;">)</span> <span style="font-weight: bold; color: #007020;">throws</span> IOException<br />
<span style="color: #666666;">{</span><br />
DataInputStream in<span style="color: #666666;">=</span><span style="font-weight: bold; color: #007020;">new</span> DateInputSteam<span style="color: #666666;">(</span><span style="font-weight: bold; color: #007020;">new</span> BufferedInputStream<span style="color: #666666;">(</span><span style="font-weight: bold; color: #007020;">new</span> FileInputStream<span style="color: #666666;">(</span><span style="color: #4070a0;">&#8220;TestEOF.java&#8221;</span><span style="color: #666666;">)));</span><br />
<span style="font-weight: bold; color: #007020;">while</span><span style="color: #666666;">(</span>in<span style="color: #666666;">.</span><span style="color: #4070a0;">available</span><span style="color: #666666;">()!=</span><span style="color: #40a070;">0</span><span style="color: #666666;">)</span><br />
<span style="color: #666666;">{</span><br />
System<span style="color: #666666;">.</span><span style="color: #4070a0;">out</span><span style="color: #666666;">.</span><span style="color: #4070a0;">print</span><span style="color: #666666;">((</span><span style="color: #902000;">char</span><span style="color: #666666;">)</span>in<span style="color: #666666;">.</span><span style="color: #4070a0;">readByte</span><span style="color: #666666;">());</span><br />
<span style="color: #666666;">}</span><br />
<span style="color: #666666;">}</span><br />
<span style="color: #666666;">}</span></div>
<p>关于文件输出：</p>
<p>首先创建与制定文件连接的FileWriter，但是为了显著增加I/O操作的性能，我们通常会用BufferedWriter将其包装起来用一缓冲输出，然后为了格式化，将它转化成PrintWriter。按照这种方式创建数据文件可作为普通文本文件读取。</p>
<p><span style="color: #ff0000;"><strong>标准I/O：</strong></span></p>
<p>JAVA提供了System.out,System.in,System.err.其中System.out已经事先被包装成了printStream对象。System.err同样也是PrintStream对象。但是System.in却是一个没有包装过的未经加工的InputStream，这就意味着我们可以立即使用System.out和System.err,但是在读取System.in之前必须对其进行包装。</p>
<p>通常我们会用readLine()一次一行的读取输入，因此我们会将Sysetem.in包装成BufferReader来使用。所以我们必须用InputStreamReader把System.in转化成Reader</p>
<p>注：readLine()会抛出IOException所以要注意声明。</p>
<p><span style="color: #ff0000;">将System.out转化成PrintWriter</span></p>
<p>System.out是一个PrintStream而PrintStream是一个OutputStream。PrintWriter有一个可以接受OutputStream作为参数的构造器。</p>
<p>PrintWriter out=new PrintWriter(System.out,true);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/11/fileio.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>java中的异常</title>
		<link>http://www.sunnyweiwei2008.cn/2008/11/exception-in-java.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/11/exception-in-java.html#comments</comments>
		<pubDate>Tue, 11 Nov 2008 12:46:09 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[异常处理]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=79</guid>
		<description><![CDATA[在java中不要求在方法中显式的声明Error和RuntimeException,如果要抛出其他异常必须提前声明我们可以用throws来声明抛出的异常,当要抛出多个异常时,用逗号隔开. 注意: 一个方法是不能抛出一个没有声明的异常. 抛出异常: 在声明了异常的方法中.如果出现了异常,就可以抛出一个异常对象例如: throw  new  TheException(); 等价于TheException  ex=new TheException(); throw  ex; 捕获异常 ：当调用一个显式声明的异常的方法时，必须使用try-catch块括住抛出异常的语句，如： Java语言: 捕获异常 try { statements that may throw exceptions } catch(Exception1 e) { handle for exception1 } cacth(Exception2 e) { handle for exception2 } &#8230; &#8230; 如果try中抛出的异常没有被任何一个catch捕获则java就会退出这个方法,并将异常传递给调用该方法的方法,继续重复寻找时间处理器的过程,如果一直没有找到,程序就会终止,并在控制台打印出错误信息. 异常对象中包含异常的有用信息,可以利用java.lang.Throwable类中的下列实例方法获取异常： public string getMessage() 返回此 Throwable或Exception 的详细消息字符串。 public string toString() 返回此 Throwable或Exception  的简短描述。 [...]]]></description>
			<content:encoded><![CDATA[<p>在java中不要求在方法中显式的声明Error和RuntimeException,如果要抛出其他异常必须提前声明我们可以用throws来声明抛出的异常,当要抛出多个异常时,用逗号隔开.</p>
<p><span style="color: #ff0000;">注意:</span> 一个方法是不能抛出一个没有声明的异常.</p>
<p>抛出异常: 在声明了异常的方法中.如果出现了异常,就可以抛出一个异常对象例如: throw  new  TheException();</p>
<p>等价于TheException  ex=new TheException();</p>
<p>throw  ex;</p>
<p><span id="more-79"></span></p>
<p>捕获异常 ：当调用一个显式声明的异常的方法时，必须使用try-catch块括住抛出异常的语句，如：</p>
<div style="background: #fdfdfd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://www.fayaa.com/code/view//">捕获异常</a></div>
<div class="source" style="font-family: "><span style="font-weight: bold; color: #007020;">try</span><br />
<span style="color: #666666;">{</span><br />
statements that may <span style="font-weight: bold; color: #007020;">throw</span> exceptions<br />
<span style="color: #666666;">}</span><br />
<span style="font-weight: bold; color: #007020;">catch</span><span style="color: #666666;">(</span>Exception1 e<span style="color: #666666;">)</span><br />
<span style="color: #666666;">{</span><br />
handle <span style="font-weight: bold; color: #007020;">for</span> exception1<br />
<span style="color: #666666;">}</span><br />
cacth<span style="color: #666666;">(</span>Exception2 e<span style="color: #666666;">)</span><br />
<span style="color: #666666;">{</span><br />
handle <span style="font-weight: bold; color: #007020;">for</span> exception2<br />
<span style="color: #666666;">}</span><br />
<span style="color: #666666;">&#8230;</span> <span style="color: #666666;">&#8230;</span></div>
<p>如果try中抛出的异常没有被任何一个catch捕获则java就会退出这个方法,并将异常传递给调用该方法的方法,继续重复寻找时间处理器的过程,如果一直没有找到,程序就会终止,并在控制台打印出错误信息.</p>
<p>异常对象中包含异常的有用信息,可以利用java.lang.Throwable类中的下列实例方法获取异常：</p>
<ul>
<li>public string getMessage()</li>
</ul>
<p>返回此 Throwable或Exception 的详细消息字符串。</p>
<ul>
<li>public string toString()</li>
</ul>
<p>返回此 Throwable或Exception  的简短描述。</p>
<p>如果此 Throwable或Exception  对象是利用非空详细消息字符串创建的，则结果是三个字符串的串联：</p>
<p>1)此对象的实际类的名称</p>
<p>2)&#8221;: &#8220;（冒号和空格）</p>
<p>3)此对象的 getMessage() 方法的结果<br />
如果此 Throwable或Exception  对象利用 null 详细消息字符串创建，则返回此对象的实际类的名称。</p>
<ul>
<li>public void printStackTrace()</li>
</ul>
<p>将此 throwable 及其追踪输出至标准错误流。<br />
此方法将此 Throwable或Exception 对象的堆栈跟踪输出至错误输出流，作为字段 System.err 的值。<br />
输出的第一行包含此对象的 toString() 方法的结果。剩余行表示以前由方法 fillInStackTrace() 记录的数据。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/11/exception-in-java.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>读取配置文件的参数&#8211;ResourceBundle</title>
		<link>http://www.sunnyweiwei2008.cn/2008/10/resourcebundle.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/10/resourcebundle.html#comments</comments>
		<pubDate>Fri, 31 Oct 2008 09:09:59 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ResourceBundle]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=81</guid>
		<description><![CDATA[java中读取配置文件的参数可以使用ResourceBundle来实现： connectDB.properties文件如下： database.serverurl=jdbc:sqlserver://localhost:1433;databaseName=laberguarantee datebase.username=sa datebase.password=pimm 以下是连接数据库时读取参数的操作 ResourceBundle rb = ResourceBundle.getBundle(&#8220;connectDB&#8220;);//默认的connectDB.properties是放置在WEB-INF/classes下面的 url= rb.getString(database.serverurl); usrname= rb.getString(database.username); password=rb.getString(database.password);]]></description>
			<content:encoded><![CDATA[<p>java中读取配置文件的参数可以使用ResourceBundle来实现：</p>
<p><span style="color: #ff0000;">connectDB.properties</span>文件如下：</p>
<p>database.serverurl=jdbc:sqlserver://localhost:1433;databaseName=laberguarantee</p>
<p>datebase.username=sa<br />
datebase.password=pimm</p>
<p>以下是连接数据库时读取参数的操作</p>
<p>ResourceBundle rb = ResourceBundle.getBundle(&#8220;<span style="color: #ff0000;">connectDB</span>&#8220;);//默认的connectDB.properties是放置在WEB-INF/classes下面的<br />
url= rb.getString(database.serverurl);</p>
<p>usrname= rb.getString(database.username);</p>
<p>password=rb.getString(database.password);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/10/resourcebundle.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>类加载时初始化的顺序</title>
		<link>http://www.sunnyweiwei2008.cn/2008/09/sequence-class-initial.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/09/sequence-class-initial.html#comments</comments>
		<pubDate>Mon, 22 Sep 2008 01:43:24 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[初始化]]></category>
		<category><![CDATA[继承]]></category>
		<category><![CDATA[静态变量]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=62</guid>
		<description><![CDATA[在网上看了一个朋友的博客，里面介绍了关于静态变量的初始化问题，本来以为自己很明白了，可是自己写出结果以后发现与运行结果不同，于是上网搜了一些加载时初始化的顺序的例子，整理如下： 每个类加载的时候静态域先于非静态域，这与代码所在位置先后没有关系。 类加载时先初始化变量然后是函数/方法 无论new多少个对象，静态域只有一个，即只初始化一次，以后的new对象都不在执行静态域的代码。 当碰到继承的关系时，加载顺序是:父类静态成员，子类静态成员，父类静态成员，父类的成员变量，父类的构造方法，子类的成员变量，子类的构造方法。当再用这个类new一个对象的时候，静态的部分就不会再执行了，因为静态的部分时类中所有的实例所共享的，他在整个虚拟机的生命周期内只执行一次。 示例代码如下： Java语言: 静态变量的初始化顺序 package com.bobbee; class Bowl { public Bowl(int marker) { System.out.println(&#8220;Bowl(&#8220; + marker + &#8220;)&#8221;); } void f1(int marker) { System.out.println(&#8220;f1(&#8220; + marker + &#8220;)&#8221;); } } class Table { static Bowl bowl1 = new Bowl(1);//Table 里面还是先初始化这里，最先输出 Bowl(1)&#8212;1 public Table() //两个静态域初始化完成后，是构造函数了 { System.out.println(&#8220;Table()&#8221;);//输出 Table()&#8212;3 bowl2.f1(1);  //当然该这里了，bowl2已经有了，输出f1(1)&#8212;4 } void [...]]]></description>
			<content:encoded><![CDATA[<p>在网上看了一个朋友的博客，里面介绍了关于静态变量的初始化问题，本来以为自己很明白了，可是自己写出结果以后发现与运行结果不同，于是上网搜了一些加载时初始化的顺序的例子，整理如下：</p>
<ol>
<li>每个类加载的时候静态域先于非静态域，这与代码所在位置先后没有关系。</li>
<li>类加载时先初始化变量然后是函数/方法</li>
<li>无论new多少个对象，静态域只有一个，即只初始化一次，以后的new对象都不在执行静态域的代码。</li>
<li>当碰到继承的关系时，加载顺序是:父类静态成员，子类静态成员，父类静态成员，父类的成员变量，父类的构造方法，子类的成员变量，子类的构造方法。当再用这个类new一个对象的时候，静态的部分就不会再执行了，因为静态的部分时类中所有的实例所共享的，他在整个虚拟机的生命周期内只执行一次。</li>
</ol>
<p><span id="more-62"></span></p>
<p>示例代码如下：</p>
<div style="background: #fdfdfd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://www.fayaa.com/code/view//">静态变量的初始化顺序</a></div>
<div class="source" style="font-family: ">package com.<span style="color: #ff0000;">bobbee</span>;</p>
<p><span style="font-weight: bold; color: #000080;">class</span> Bowl<br />
{<br />
<span style="font-weight: bold; color: #000080;">public</span> Bowl(<span style="font-weight: bold; color: #000080;">int</span> marker)<br />
{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;Bowl(&#8220;</span> + marker + <span style="color: #0000ff;">&#8220;)&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">void</span> f1(<span style="font-weight: bold; color: #000080;">int</span> marker)<br />
{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;f1(&#8220;</span> + marker + <span style="color: #0000ff;">&#8220;)&#8221;</span>);<br />
}<br />
}</p>
<p><span style="font-weight: bold; color: #000080;">class</span> Table</p>
<p>{<br />
<span style="font-weight: bold; color: #000080;">static</span> Bowl bowl1 = <span style="font-weight: bold; color: #000080;">new</span> Bowl(<span style="color: #0000ff;">1</span>);<span style="font-style: italic; color: #008800;">//Table 里面还是先初始化这里，最先输出 Bowl(1)&#8212;1</span></p>
<p><span style="font-weight: bold; color: #000080;">public</span> Table() <span style="font-style: italic; color: #008800;">//两个静态域初始化完成后，是构造函数了</span></p>
<p>{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;Table()&#8221;</span>);<span style="font-style: italic; color: #008800;">//输出 Table()&#8212;3</span><br />
bowl2.<span style="color: #ff0000;">f1</span>(<span style="color: #0000ff;">1</span>);  <span style="font-style: italic; color: #008800;">//当然该这里了，bowl2已经有了，输出f1(1)&#8212;4</span><br />
}<br />
<span style="font-weight: bold; color: #000080;">void</span> f2(<span style="font-weight: bold; color: #000080;">int</span> marker)<br />
{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;f2(&#8220;</span> + marker + <span style="color: #0000ff;">&#8220;)&#8221;</span>);<br />
}</p>
<p><span style="font-weight: bold; color: #000080;">static</span> Bowl bowl2 = <span style="font-weight: bold; color: #000080;">new</span> Bowl(<span style="color: #0000ff;">2</span>);<span style="font-style: italic; color: #008800;">//Bowl(1)完了，该这里了，初始化Bowl(2),输出 Bowl(2)&#8212;2</span></p>
<p>}</p>
<p><span style="font-weight: bold; color: #000080;">class</span> Cupboard<br />
{<br />
Bowl bowl3 = <span style="font-weight: bold; color: #000080;">new</span> Bowl(<span style="color: #0000ff;">3</span>);<span style="font-style: italic; color: #008800;">//终于该我了，下面两个静态的，很牛嘛。输出 Bowl(3)，&#8212;7；从10又回来了，这下没下面两个什么事情了，因为，是静态的嘛，呵呵，照样输出 Bowl(3)，&#8212;11；懒得说了，&#8212;15</span></p>
<p><span style="font-weight: bold; color: #000080;">static</span> Bowl bowl4 = <span style="font-weight: bold; color: #000080;">new</span> Bowl(<span style="color: #0000ff;">4</span>);<span style="font-style: italic; color: #008800;">//同样的，先初始化静态域，输出 Bowl(4)，上面的要等一等了，谁让你不是静态域呢？:)&#8212;5</span></p>
<p><span style="font-weight: bold; color: #000080;">public</span> Cupboard()<span style="font-style: italic; color: #008800;">//7初始化完毕，构造函数开始&#8230;；从11又来了；</span></p>
<p>{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;Cupboard()&#8221;</span>);<span style="font-style: italic; color: #008800;">//简简单单的输出，哪有你们上面的那么复杂&#8212;8；依旧简简单单的输出 &#8212;12；&#8230;&#8212;16</span><br />
bowl4.<span style="color: #ff0000;">f1</span>(<span style="color: #0000ff;">2</span>);<span style="font-style: italic; color: #008800;">//bowl4 已经在了，调用它的f1()方法，输出f1(2)&#8212;9；从上面来的，bowl4 仍然在，继续输出f1(2)&#8212;13；&#8230;&#8212;17</span><br />
}<br />
<span style="font-weight: bold; color: #000080;">void</span> f3(<span style="font-weight: bold; color: #000080;">int</span> marker)<br />
{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;f3(&#8220;</span> + marker + <span style="color: #0000ff;">&#8220;)&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">static</span> Bowl bowl5 = <span style="font-weight: bold; color: #000080;">new</span> Bowl(<span style="color: #0000ff;">5</span>);<span style="font-style: italic; color: #008800;">//bowl3，你还是再等等吧，我先来，我也是静态域，虽然我在下面，没办法~~~ &#8212;6</span><br />
}</p>
<p><span style="font-weight: bold; color: #000080;">class</span> StaticInitialization<br />
{<br />
<span style="font-weight: bold; color: #000080;">public</span> <span style="font-weight: bold; color: #000080;">static</span> <span style="font-weight: bold; color: #000080;">void</span> main(String[] args)<span style="font-style: italic; color: #008800;">//从这里开始~~，不过别急，先初始化下面的静态域 table 和 Cupboard。 </span><br />
{<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;Creating new Cupboard() in main&#8221;</span>);<span style="font-style: italic; color: #008800;">//从9开始才真正的到这里，虽然在 main 里，好惨~~ &#8212;10</span><br />
<span style="font-weight: bold; color: #000080;">new</span> Cupboard(); <span style="font-style: italic; color: #008800;">// new 了一个对象</span><br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;Creating new Cupboard() in main&#8221;</span>);<span style="font-style: italic; color: #008800;">//从13过来，又来~~你烦不烦~~，继续输出&#8212;14</span><br />
<span style="font-weight: bold; color: #000080;">new</span> Cupboard(); <span style="font-style: italic; color: #008800;">//又 new 了一个对象，我为什么要说 又..</span></p>
<p>table.<span style="color: #ff0000;">f2</span>(<span style="color: #0000ff;">1</span>);<span style="font-style: italic; color: #008800;">//从17回来，f2(1)&#8212;18</span><br />
cupboard.<span style="color: #ff0000;">f3</span>(<span style="color: #0000ff;">1</span>);<span style="font-style: italic; color: #008800;">//f3(1)，&#8212;19完</span><br />
}<br />
<span style="font-weight: bold; color: #000080;">static</span> Table table = <span style="font-weight: bold; color: #000080;">new</span> Table();<span style="font-style: italic; color: #008800;">//所以说，实际上是从这里开始先加载 Table 类</span><br />
<span style="font-weight: bold; color: #000080;">static</span> Cupboard cupboard = <span style="font-weight: bold; color: #000080;">new</span> Cupboard();<span style="font-style: italic; color: #008800;">//4完后，该这里了&#8230;</span><br />
}</p>
</div>
<p>运行结果：<br />
Bowl(1)</p>
<p>Bowl(2)</p>
<p>Table()</p>
<p>f1(1)</p>
<p>Bowl(4)</p>
<p>Bowl(5)</p>
<p>Bowl(3)</p>
<p>Cupboard()</p>
<p>f1(2)</p>
<p>Creating new Cupboard() in main</p>
<p>Bowl(3)</p>
<p>Cupboard()</p>
<p>f1(2)</p>
<p>Creating new Cupboard() in main</p>
<p>Bowl(3)</p>
<p>Cupboard()</p>
<p>f1(2)</p>
<p>f2(1)</p>
<p>f3(1)</p>
<p>关于有继承关系时的初始化示例如下：</p>
<div style="background: #fdfdfd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="text-decoration: underline;">Java语言</span>: <a href="http://www.fayaa.com/code/view//">继承关系存在时静态变量的初始化顺序</a></div>
<div class="source" style="font-family: ">package test1;<br />
<span style="font-weight: bold; color: #000080;">public</span> <span style="font-weight: bold; color: #000080;">class</span> Test4 {<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">void</span> testClassForName(String name) <span style="font-weight: bold; color: #000080;">throws</span> ClassNotFoundException{<br />
Class c=Class.<span style="color: #ff0000;">forName</span>(name);<br />
}<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">void</span> testNewInstance(String name) <span style="font-weight: bold; color: #000080;">throws</span> ClassNotFoundException, InstantiationException, IllegalAccessException{<br />
Class c=Class.<span style="color: #ff0000;">forName</span>(name);<br />
Object obj=c.<span style="color: #ff0000;">newInstance</span>();<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(obj);<br />
}<br />
<span style="font-weight: bold; color: #000080;">public</span> <span style="font-weight: bold; color: #000080;">static</span> <span style="font-weight: bold; color: #000080;">void</span> main(String[] args)<span style="font-weight: bold; color: #000080;">throws</span> Exception {<br />
Test4 t=<span style="font-weight: bold; color: #000080;">new</span> Test4();<br />
t.<span style="color: #ff0000;">testClassForName</span>(<span style="color: #0000ff;">&#8220;test1.B&#8221;</span>);<br />
<span style="font-weight: bold; color: #000080;">new</span> B();<br />
<span style="font-weight: bold; color: #000080;">new</span> B();<br />
}<br />
}<br />
<span style="font-weight: bold; color: #000080;">class</span> A{<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">int</span> aj;<br />
{<br />
aj=<span style="color: #0000ff;">20</span>;<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;A成员初始化块&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">static</span> <span style="font-weight: bold; color: #000080;">int</span> ai;<br />
<span style="font-weight: bold; color: #000080;">static</span> {<br />
ai=<span style="color: #0000ff;">10</span>;<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;A静态初始化块&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">public</span> A(){<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;A构造函数&#8221;</span>);<br />
}<br />
}<br />
<span style="font-weight: bold; color: #000080;">class</span> B <span style="font-weight: bold; color: #000080;">extends</span> A{<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">static</span> <span style="font-weight: bold; color: #000080;">int</span> bi;<br />
<span style="font-weight: bold; color: #000080;">static</span> {<br />
bi=<span style="color: #0000ff;">30</span>;<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;B静态初始化块&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">private</span> <span style="font-weight: bold; color: #000080;">int</span> bj;<br />
{<br />
bj=<span style="color: #0000ff;">40</span>;<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;B成员初始化块&#8221;</span>);<br />
}<br />
<span style="font-weight: bold; color: #000080;">public</span> B(){<br />
System.<span style="color: #ff0000;">out</span>.<span style="color: #ff0000;">println</span>(<span style="color: #0000ff;">&#8220;B构造函数&#8221;</span>);<br />
}<br />
}</div>
<p>结果如下：<br />
A静态初始化块<br />
B静态初始化块<br />
A成员初始化块<br />
A构造函数<br />
B成员初始化块<br />
B构造函数<br />
A成员初始化块<br />
A构造函数<br />
B成员初始化块<br />
B构造函数</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/09/sequence-class-initial.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于编写jsp代码时常用到的一些代码</title>
		<link>http://www.sunnyweiwei2008.cn/2008/07/%e5%85%b3%e4%ba%8e%e7%bc%96%e5%86%99jsp%e4%bb%a3%e7%a0%81%e6%97%b6%e5%b8%b8%e7%94%a8%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e4%bb%a3%e7%a0%81.html</link>
		<comments>http://www.sunnyweiwei2008.cn/2008/07/%e5%85%b3%e4%ba%8e%e7%bc%96%e5%86%99jsp%e4%bb%a3%e7%a0%81%e6%97%b6%e5%b8%b8%e7%94%a8%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e4%bb%a3%e7%a0%81.html#comments</comments>
		<pubDate>Mon, 14 Jul 2008 08:35:50 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jsp]]></category>

		<guid isPermaLink="false">http://www.sunnyweiwei.cn/?p=10</guid>
		<description><![CDATA[要想在jsp处理页面的最后给以人性化的提示，比如插入数据库成功、修改成功、等等来通知用户，我们可以在java代码中加入out.println(&#8220;alert(&#8216;数据库修改成功！&#8217;)&#8221;)； 如果想要由当前的页面跳转到另一个jsp页面可以用out.println(&#8220;window.location=\&#8221;../log.jsp\&#8221;"); 在js中如果要是超链接另一个js的话可以按照如下实现  newRow.cells[2].innerHTML = &#8220;&#60;a href=\&#8221;javascript:delFile(&#8220;+rowSize+&#8221;)\&#8221;&#62;删除&#60;/a&#62;&#8221;;]]></description>
			<content:encoded><![CDATA[<p>要想在jsp处理页面的最后给以人性化的提示，比如插入数据库成功、修改成功、等等来通知用户，我们可以在java代码中加入out.println(&#8220;alert(&#8216;数据库修改成功！&#8217;)&#8221;)；</p>
<p>如果想要由当前的页面跳转到另一个jsp页面可以用out.println(&#8220;window.location=\&#8221;../log.jsp\&#8221;");</p>
<p>在js中如果要是超链接另一个js的话可以按照如下实现 </p>
<p>newRow.cells[2].innerHTML = &#8220;&lt;a href=\&#8221;javascript:delFile(&#8220;+rowSize+&#8221;)\&#8221;&gt;删除&lt;/a&gt;&#8221;;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunnyweiwei2008.cn/2008/07/%e5%85%b3%e4%ba%8e%e7%bc%96%e5%86%99jsp%e4%bb%a3%e7%a0%81%e6%97%b6%e5%b8%b8%e7%94%a8%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e4%bb%a3%e7%a0%81.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

