使用:props.load(DBUtils.class.getClassLoader().getResourceAsStream("day01/db.properties"));导入配置文件使用的是反射机制.class///获得Class对象.class.getClassLoader()///获得ClassLoader对象.class.getClassLoader().getResourceAsStream(Stringname);//获得inputStr..
分类:
数据库 时间:
2014-05-27 04:00:33
阅读次数:
241
/*【程序8】
题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制。*/
packagetest;
importjava.util.Scanner;
publicclasstest{
publicstaticintsum(intnumber,intinput){
intresult=0;
inttem=number;
..
分类:
编程语言 时间:
2014-05-27 03:57:44
阅读次数:
237
/*【程序5】
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。
1.程序分析:(a>b)?a:b这是条件运算符的基本例子。*/
packagetest;
publicclasstest{
publicstaticStringgrade(intnum){
Stringresult=(num..
分类:
编程语言 时间:
2014-05-27 03:54:17
阅读次数:
247
/*【程序9】
题目:一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如6=1+2+3.编程找出1000以内的所有完数。*/
packagetest;
importjava.util.ArrayList;
importjava.util.List;
publicclasstest{
publicstaticbooleanovernum(intnumber){
List<Integer>list=..
分类:
编程语言 时间:
2014-05-27 03:34:38
阅读次数:
245
/*【程序7】
题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
1.程序分析:利用while语句,条件为输入的字符不为‘\n‘.*/
packagetest;
importjava.util.ArrayList;
importjava.util.List;
publicclasstest{
publicstaticList<Integer>countstr..
分类:
编程语言 时间:
2014-05-27 03:32:01
阅读次数:
375
从main()函数开始
public static void main(String [] args) {
VersionInfo.logVersion();
new HMasterCommandLine(HMaster.class).doMain(args);
}
public void doMain(String args[]) {
try {
...
分类:
其他好文 时间:
2014-05-22 09:31:11
阅读次数:
348
既然jsp和servlet是等价的,在jsp中可以使用内置对象,那么在servlet中也可以使用。
1.获得out对象
可以使用如下代码获得out对象:
import java.io.PrintWriter;
...
public void doGet(HttpServletRequest request,HttpServletResponse response)throws
Ser...
分类:
编程语言 时间:
2014-05-22 07:53:54
阅读次数:
230
Bob(Bob‘spublickey)(Bob‘sprivatekey)Bobhasbeengiventwokeys.OneofBob‘skeysiscalledaPublicKey,theotheriscalledaPrivateKey.Bob‘sCo-workers:AnyonecangetBob‘sPublicKey,butBobkeepshisPrivateKeytohimselfPatDougSusanBob‘sPublickeyisavailabletoanyonewhoneedsit,buthe..
分类:
其他好文 时间:
2014-05-21 00:05:52
阅读次数:
478
/*【程序10】
题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?*/
packagetest;
publicclasstest{
publicstaticvoidmain(String[]args){
//TODOAuto-generatedmethodstub
doublehigh=100.0..
分类:
编程语言 时间:
2014-05-20 23:22:10
阅读次数:
330
AsI’mworkingonaproductthatwillmakeheavyuseofencryption,I’vefoundmyselftryingtoexplainpublic-keycryptographytofriendsmorethanoncelately.Tomysurprise,anythingrelatedI’vecomeacrossonlinemakesitlookmorecomplicatedthanitshould.Butit’snot.Firstofall,let’ssee..
分类:
其他好文 时间:
2014-05-20 21:05:11
阅读次数:
430