Thursday, October 26, 2006

经典java问题,你能答出几个?  [Java]

经典java问题,你能答出几个?  [Java]: " 第二,Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?"

Wednesday, October 25, 2006

我的记事本开发手记

由于需要我需要一个具有特殊功能的记事本~
本着学习java和熟练的目的,我决心自己写一个,hoho~
今天遇到了需要强制把String强制转化为一个char的问题,具体来说就是,我需要在
文本文件中产生换行*(期间问题参看前两个文章),但是总是无法实现:最好调试
发现是一个小错误,555
成功后的代码如下:
if (rs) {
//java.lang.Thread.sleep(1); //ensure for jProgressBar1
out.write(m.group());
String separator = null;
if (jTextField4.getText().equals("\\n")) { //this //n driver me crazy once.
separator = System.getProperty("line.separator");
} else {
separator = jTextField4.getText();
}
out.write(separator);
// out.write(System.getProperty("line.separator"));
}
解决的分行的问题

Huihoo.org - Java 程序编码规范

Huihoo.org - Java 程序编码规范

Java文件操作新问题如何解决记事本的换行 - mc1035的专栏 - CSDNBlog

今天又做了一个关于java文件读写的问题,原先认为会java的数据库就ok了,但现在一看,文件的读写,线程等问题全都是非常重要的啊!!呵呵,好切 入正题,今天的问题是当我向一个记事本里写入输入流时,当全部完毕时,打开记事本一看 ,里面全是秘密嘛嘛的文字,根本没有换行,后来我每写一句加个“\n”,但再开记事本发现凡是改输出"\n"的地方全都变成了■,可是当我用world, 或是写字板,甚至DreamWeaver 8打开时也有换行,这是怎么回事??难道是编码问题???对头,就是这个问题,我查了差资料,发现记事本的换行符号是"\r\n"。嘿嘿,加上后问题全部 解决,其实这个也不是什么大问题,但俺还是想发出来,方便别人就是方便自己,因为我也是在网上找的资料,如果没有人发帖的话俺也不会这么快解决这个问题 的,所以在这里还得感谢一下那位不知名的认。
再强调一下,记事本里的换行是"\r\n"。
如果要做到跨平台使用,可能需要使用
String str= System.getProperty("line.separator");
来获取换行符。

linux使用 \n
windows使用\r\n
其它操作系统可能也不同。在这里感谢weacer和mc1035,后面的是他提出的,只是在这里我写的罢了

JAVA数据类型转换--西部E网weste.net

JAVA数据类型转换--西部E网weste.net

Saturday, September 30, 2006

EYBS2

EYBS2: "
A girl and a boy were on a motorcycle, speeding through the night.They loved each other a lot..

As the Girl feel that its unbelievable speed, she said to the boy:' Slow down a little.. I'm scared..' But Boy said: 'No, it's so fun..'

The Girl begged: 'Please... it's so scary..'

The Boy said: 'Then say that you love me..'

Girl feel very confusing but she had to do what she was told: 'Fine..I love you..Can you slow down now?'

Boy seems not satisfy with what he get, he asked for more: 'Give me a big hug..'
The girl had no other choice but gave him a big hug.

Girl said: 'can you slow down Now?'

Boy replied : 'Can you take off my helmet and put it on? It's uncomfortable and It's bothering me a lot while I drive.'

The next day, there was a story in the newspaper. a motorcycle had crashed into a building because its brakes were broken. There were two people on the motorcycle, of which one died, and the other had survived...

The guy knew that the brakes were broken. He didn't want to let the girl know, because he knew that the girl would have gotten scared.

Instead, he was told the last time that she loved him, and got a hug from her, then he put his helmet on her so that she can live, and die himself...

Once in awhile, right in"