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

Java¶ÁÈ¡PropertiesÎļþµÄÁùÖÖ·½·¨

 Ê¹ÓÃJ2SE API¶ÁÈ¡PropertiesÎļþµÄÁùÖÖ·½·¨
1¡£Ê¹ÓÃjava.util.PropertiesÀàµÄload()·½·¨
ʾÀý£º InputStream in = lnew BufferedInputStream(new FileInputStream(name));
Properties p = new Properties();
p.load(in);
2¡£Ê¹ÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨
ʾÀý£º ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault());
3¡£Ê¹ÓÃjava.util.PropertyResourceBundleÀàµÄ¹¹Ô캯Êý
ʾÀý£º InputStream in = new BufferedInputStream(new FileInputStream(name));
ResourceBundle rb = new PropertyResourceBundle(in);
4¡£Ê¹ÓÃclass±äÁ¿µÄgetResourceAsStream()·½·¨
ʾÀý£º InputStream in = JProperties.class.getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
5¡£Ê¹ÓÃclass.getClassLoader()ËùµÃµ½µÄjava.lang.ClassLoaderµÄgetResourceAsStream()·½·¨
ʾÀý£º InputStream in = JProperties.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);
²¹³ä
ServletÖпÉÒÔʹÓÃjavax.servlet.ServletContextµÄgetResourceAsStream()·½·¨
ʾÀý£ºInputStream in = context.getResourceAsStream(path);
Properties p = new Properties();
p.load(in);


Ïà¹ØÎĵµ£º

Java¶ÁÈ¡ÎļþµÄ¼òµ¥´úÂë

ÕâÊÇÒ»¸ö¼òµ¥µÄ¶ÁÈ¡ÎļþµÄ´úÂ룬²¢ÊÔ×ŶÁȡһ¸ölogÎļþ£¬ÔÙÊä³ö¡£
import java.io.*;
public class FileToString {
public static String readFile(String fileName) {
String output = "";

File file = new File(fileName);

if(file.exists()){
......

ÔÚJavaÖе÷ÓÃC++

ÔÚjavaÖе÷ÓÃ×Ô¼ºµÄc++´úÂëÊÇÒ»¼þ¼òµ¥µÄÊÂÇ飬ÒÔÏÂÀàΪÀý£º
class Prompt {
  private native String getLine(String prompt);
  public static void main(String args[]) {
    Prompt p = new Prompt();
    String input = p.getLine("Type a line: ");
  &nbs ......

javascriptʵÏÖÏñjava¡¢c#Ö®ÀàµÄsleepÔÝÍ£µÄº¯Êý¹¦ÄÜ

ÎÒÃǶ¼ÖªµÀjava¡¢c#¡¢vbµÈÓïÑÔ¶¼ÓÐsleepÔÝÍ£µÄº¯Êý£¬¶øJavaScript½Å±¾Ã»ÓÐÀàËÆµÄ¹¦ÄÜ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄʵÏֵķ½·¨£º
<mce:script type="text/javascript"><!--
function test()
{
var s="javascript--ÔÝÍ£º¯Êý";
setTimeout(
function(){
eval(sleep(test)); //Ö´ÐÐreturnÖ®ºóµÄ´úÂ룬Ҳ¾ÍÊÇ&ldq ......

ʹÓÃԭ֭ԭζµÄJava ÓïÑÔ

±¾ÎÄÕª×Ô£º http://www.ibm.com/developerworks/cn/java/j-noaccent.html
ѧϰһÖÖеıà³ÌÓïÑÔ±ÈѧϰеĿÚÍ·ÓïÑÔÒªÈÝÒ׵öࡣȻ¶ø£¬ÔÚÕâÁ½ÖÖѧϰ¹ý³ÌÖУ¬¶¼Òª¸¶³ö¶îÍâµÄŬÁ¦È¥Ñ§Ï°²»´ø¿ÚÒôµØËµÐÂÓïÑÔ¡£Èç¹ûÄúÊìϤ C »ò C++£¬ÄÇôѧϰ Java ÓïÑÔ²¢²»À§ÄÑ£¬Õâ¾ÍÏñÊÇ»á˵ÈðµäÓïµÄÈËȥѧµ¤ÂóÓïÒ»Ñù¡£ÓïÑÔËäÓв»Í¬£¬µ«Óֱ˴˻ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ