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

Java ¶ÁÈ¡ÊôÐÔÎļþ

// messages.hello.properties
id=001
name=ϧԵ
love=I think,therefor i am.
friends=Hi! {0} and {1} ,how are you?
// org.PropertiesUtil.java
package org;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class PropertiesUtil {
private static String encoding = "UTF-8";
/**
* read the message with key from the resource bundle
* @param bundlePath
* @param key
* @return
*/
public static String getString(String bundlePath,String key){
return getString(bundlePath,key,null);
}
/**
* read the message with key from the resource bundle
* @param bundlePath
* @param key
* @param args
* @return
*/
public static String getString(String bundlePath,String key,Object[] args){
// we will throw a MessingResourceException if the bundle name is invalid
ResourceBundle bundle = getBundle(bundlePath);
try{
String msg = bundle.getString(key);
if(msg == null){
return "";
}
// change the message encoding
msg = convertISO(msg);
return msg = MessageFormat.format(msg, args);
} catch(MissingResourceException e){
return "";
}
}
/**
* get ResourceBundle with bundlePath
* @param bundlePath
* @return
* @throws MissingResourceException if resource is messing
*/
private static ResourceBundle getBundle(String bundlePath){
Locale locale = Locale.getDefault();
ResourceBundle bundle = ResourceBundle.getBundle(bundlePath,locale,getClassLoader());
return bundle;
}
/**
* get the current ClassLoader
* @return
*/
protected static ClassLoader getClassLoader(){
return PropertiesUtil.class.getClassLoader();
}
/**
* convert msg encoding
* @param msg
* @return
*/
public static String convertISO(String msg){
if(msg != null){
try{
return new String(msg.getBytes("iso-8859-1"),getEncoding());
} catch(


Ïà¹ØÎĵµ£º

javaÖеÄSystem.currentTimeMillis()º¯Êý

System.currentTimeMillis()£º¿ÉÒÔÌáÈ¡µ½µ±Ç°Ê±¼äµÄºÁÃëÊý£¬²úÉúÒ»¸öµ±Ç°µÄºÁÃ룬Õâ¸öºÁÃëÆäʵ¾ÍÊÇ×Ô1970Äê1ÔÂ1ÈÕ0ʱÆðµÄºÁÃëÊý¡£
³£¼û×÷ÓãºÒ»°ã¶¼ÊÇÓÃ2¸öʱ¼äµÄ²îÖµÀ´µÃµ½ÔËÐÐʱ¼äµÄ£¬³£ÓÃÀ´±È½Ï2¸öËã·¨µÄЧÂÊ£¡
long start = System.currentTimeMillis();
  // ÕâÀï¿ÉÒÔ¼ÓÉÏÄãÒªÖªµÀµÄ·½·¨ÔËÐеÄʱ¼ä£¡£¡
......

JAVA³£Ó÷½·¨

01¡¢ÈÿؼþµÃµ½½¹µã
    ÓÃ.requestFocus();¿ÉÒÔ»ñµÃ¿Ø¼þ½¹µã¡£
    nextFocus()Ôò¿É½øÈëÏÂÒ»¸ö½¹µã¡£
02¡¢½«StringÀàÐÍתΪintÀàÐÍ
    Integer.parseInt(String);
03¡¢½«IntegerÀàÐÍתΪStringÀàÐÍ
    String.valueOf(Integer); ......

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë

Ãô½Ý¿ª·¢µÄÀíÄîÒѾ­Á÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾­Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓÚά
»¤£¬ÐèÒª½Ï´óµÄ²âÊÔͶÈëºÍÖÜÆÚµÈÎÊÌâ¡£ÕâЩÎÊÌâÔÚÒ»¸ ......

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë
2010-03-08 10:32
 | 
1709
´ÎÔĶÁ
 | 
¡¾ÒÑÓÐ9
ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
À´Ô´£º±ÈÌØÍø À´Ô´£ºIBM/ÍõÓÀ¿ý
 | 
Êղص½ÎÒµÄÍøÕª
Ãô½Ý¿ª·¢µÄÀíÄîÒѾ­Á÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡ ......

javaº¯ÊýµÄ²ÎÊý´«µÝºÍStringÀàÐÍ

ÒÔÏÂÄÚÈÝÕª×Ôjavaº¯ÊýµÄ²ÎÊý´«µÝºÍStringÀàÐÍ http://www.blogjava.net/thuixy/archive/2009/06/06/280302.html
˵ÍêÁËjavaµÄStringÀàÐÍ£¬ÎÒÃÇ×îºó¿´¿´javaº¯Êý²ÎÊýµÄ´«µÝ£¬µ½µ×ÊÇÖµ´«µÝ»¹ÊÇÒýÓô«µÝÄØ£¿Ò»°ãµÄ˵·¨ÊǶÔÓÚ»ù±¾ÀàÐͱÈÈçint¡¢charÊÇÖµ´«µÝ£¬¶ÔÓÚ¶ÔÏóÀàÐÍÊÇÒýÓô«µÝ¡£ÕâÖÖ˵·¨Ã»´í£¬µ«ÊÇÇë¿´ÏÂÃæµÄÀý×Ó£º
Str ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ