Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÖжÁÈ¡propertiesÎļþµÄ¼¸ÖÖ·½·¨

¡¡1¡¢Ê¹ÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨
ʾÀý£º
String name = "logging"; // the logging.properties file in src root folder
ResourceBundle rb = ResourceBundle.getBundle(name,Locale.getDefault());
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propertyKey));
¡¡2¡¢Ê¹ÓÃjava.util.PropertyResourceBundleÀàµÄ¹¹Ôì·½·¨
ʾÀý£º
String fileName = "src/logging.properties"; // the file path
InputStream in = new FileInputStream(fileName));
ResourceBundle rb = new PropertyResourceBundle(in);
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propertyKey));
¡¡3¡¢Ê¹ÓÃjava.util.PropertiesÀàµÄload()·½·¨
ʾÀý£º
String fileName = "src/logging.properties"; // the file path
InputStream in = new FileInputStream(fileName));
Properties prop = new Properties();
prop.load(in);
 
// test the prop
String propertyKey = "xxx";
System.out.println(prop.getProperty(propertyKey));
¡¡4¡¢Ê¹ÓÃclass±äÁ¿µÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = Properties.class.getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡5¡¢Ê¹ÓÃclass.getClassLoader()ËùµÃµ½µÄjava.lang.ClassLoaderµÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = Properties.class.getClassLoader().getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡6¡¢Ê¹ÓÃjava.lang.ClassLoaderÀàµÄgetSystemResourceAsStream()¾²Ì¬·½·¨
ʾÀý£º
InputStream in = ClassLoader.getSystemResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡7¡¢ServletÖпÉÒÔʹÓÃjavax.servlet.ServletContextµÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = context.getResourceAsStream(path);
Properties p = new Properties();
p.load(in);


Ïà¹ØÎĵµ£º

Java´òÓ¡³ÌÐòÉè¼ÆÈ«¹¥ÂÔ

[ת]Java´òÓ¡³ÌÐòÉè¼ÆÈ«¹¥ÂÔ
2008-12-07 18:43
Ç°ÑÔ
¡¡¡¡ÔÚÎÒÃǵÄʵ¼Ê¹¤×÷ÖУ¬¾­³£ÐèҪʵÏÖ´òÓ¡¹¦ÄÜ¡£µ«ÓÉÓÚÀúÊ·Ô­Òò£¬JavaÌṩµÄ´òÓ¡¹¦ÄÜÒ»Ö±¶¼±È½ÏÈõ¡£Êµ¼ÊÉÏ×î³õµÄjdk¸ù±¾²»Ö§³Ö´òÓ¡£¬Ö±µ½jdk1.1²ÅÒýÈëÁ˺ÜÇáÁ¿µÄ´òÓ¡Ö§³Ö¡£ËùÒÔ£¬ÔÚÒÔÇ°ÓÃJava/Applet/JSP/ServletÉè¼ÆµÄ³ÌÐòÖУ¬½Ï¸´ÔӵĴòÓ¡¶¼ÊÇͨ¹ýµ÷ÓÃActiveX/OCX¿ ......

java Óë c# ¶Ô±È ˼¿¼

´ÓʱàÂë7Äê¶àÁË
¶ÔÓÚjava ºÍc# ÎÒÓÐ×Å×Ô¼ºµÄÀí½â
ÔÚ2009ÄêµÄ9ÔÂÕâ¸öʱ¼äµãÎÒ¿´À´java  c#ÊÇÐÂʽÓïÑԵĴú±í
{ÒòΪÎÒÈÏΪ¼ÆËã»úµÄ·¢Õ¹Àú³ÌÊÇ
µÚÒ»½×¶Î ´ò¿×»ú(¶þ½øÖÆ),
µÚ2½×¶Î »ã±à, (±È¶þ½øÖÆ·½±ãµÄÓïÑÔ),
µÚ3½×¶Î c (¸üÒ×ÓÚ¿´Ã÷°×µÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ1²ã c++ (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ2² ......

ÈçºÎÀûÓÃjavaµÃµ½µ±Ç°µÄʱ¼äºÍÇ°Ò»ÌìµÄʱ¼ä

1.µÃµ½µ±Ç°µÄʱ¼ä
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.substring(0, 16);// 2007-10-30 09:30
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.subst ......

javaÖÐÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server

ÔÚ¡¶JDBC Driver For SQL2000/2005/2008
¡·Ò»ÎÄÖУ¬ÑûÔ½éÉÜÁËÈçºÎÏÂÔز¢Ê¹ÓÃjdbcÁ¬½ÓSQL Server,
½ñÌìÓÐÈËÎÊÆð£¬ÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server,Õâ¸öÒÔÇ°ÕæûÊÔ¹ý¡£
ÓÚÊÇ£¬´ò¿ªnetBeans²âÊÔÁËһϣ¬´úÂëÈçÏ£º
/*
* To change this template, choose Tools | Templates
* and open the template in the edit ......

JAVAµÄÈÝÆ÷

JAVAµÄÈÝÆ÷---List,Map,Set
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð© CollectionÔÊÐíÏà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ