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

Java 6 ÖÐÒ²¿ÉÒÔÔËÐÐ javascript ච(ת)

¸ø Java SE ×¢Èë½Å±¾ÓïÑԵĻîÁ¦
Mustang µÄ½Å±¾ÓïÑÔÐÂÌØÐÔ

ÎĵµÑ¡Ïî

½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ

½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ



¼¶±ð£º Öм¶
Îâ 玥ò« (wuyuehao@cn.ibm.com), Èí¼þ¹¤³Ìʦ, IBM
2006 Äê 10 ÔÂ 30 ÈÕ
ÔÚ¼´½«·¢²¼µÄ Java SE6£¨Mustang£©ÖУ¬Ôö¼ÓÁ˶Խű¾ÓïÑÔµÄÖ§³Ö¡£Í¨¹ý¶Ô½Å±¾ÓïÑԵĵ÷Óã¬Ê¹µÃһЩͨ³£Óà Java ±È½ÏÄÑÓÚʵÏֵŦÄܱäµÃ¼òµ¥ºÍÇá±ã¡£½Å±¾ÓïÑÔÓë Java Ö®¼äµÄ»¥²Ù×÷½«±äµÃÓÅÑŶøÖ±½Ó¡£
½Å±¾ÓïÑÔÓë Java
¼ÙÉèÎÒÃÇÓÐÒ»¸ö¼òµ¥µÄÐèÇ󣬲쿴һ·ÝÎĵµÖÐ 5 ¸ö×Öĸ×é³ÉµÄµ¥´ÊµÄ¸öÊý¡£Óà Java Ò»°ãʵÏÖÈçÏ£º
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Find5Words {
public static void main(String[] args) throws IOException {
String result = "";
String line = null;
int num = 0;
FileReader fr = new FileReader("filename");
BufferedReader br = new BufferedReader(fr);
while ((line = br.readLine()) != null) {
result += line;
}
br.close();
fr.close();
String[] s = result.split(" ");
for (int i = 0; i < s.length; i++) {
if (s[i].matches("^\\w{5}$")) {
num++;
}
}
System.out.println(num);
}
}

ÔÙ¿´¿´ Perl ÓïÑÔʵÏÖͬÑù¹¦ÄܵĴúÂ룺
open FILE, "<filename ";
while (<FILE>) {
for (split) {
$num++ if /^\w{5}$/
}
}
print $num;

ÄÇôÓÐûÓÐÒ»ÖÖÓÅÑŵķ½Ê½½« Java Óë½Å±¾ÓïÑÔ½áºÏÄØ£¬ÔÚ½ñÄêÇï¼¾¼´½«·¢²¼µÄ Java SE6£¨´úºÅ Mustang£©ÖУ¬Õ⽫³ÉΪÏÖʵ¡£

»ØÒ³Ê×

Mustang µÄ½Å±¾ÒýÇæ
JSR 233 Ϊ Java Éè¼ÆÁËÒ»Ì׽ű¾ÓïÑÔ API¡£ÕâÒ»Ì× API ÌṩÁËÔÚ Java ³ÌÐòÖе÷Óø÷Öֽű¾ÓïÑÔÒýÇæµÄ½Ó¿Ú¡£ÈκÎʵÏÖÁËÕâÒ»½Ó¿ÚµÄ½Å±¾ÓïÑÔÒýÇ涼¿ÉÒÔÔÚ Java ³ÌÐòÖб»µ÷Óá£ÔÚ Mustang µÄ·¢Ðа汾ÖаüÀ¨ÁËÒ»¸ö»ùÓÚ Mozilla Rhino µÄ JavaScript ½Å±¾ÒýÇæ¡£
Mozilla Rhino
Rhino ÊÇÒ»¸ö´¿ Java µÄ¿ªÔ´µÄ JavaScript ʵÏÖ¡£ËûµÄÃû×ÖÀ´Ô´ÓÚ O'Reilly ¹ØÓÚ JavaScript µÄÊéµÄ·âÃ棺

Rhino ÏîÄ¿¿ÉÒÔ×·Ë·µ½ 1997 Ä꣬µ±Ê± Netscape ¼Æ»®¿ª·¢Ò»¸ö´¿ Java ʵÏÖµÄ


Ïà¹ØÎĵµ£º

Javascript ¼Ì³Ð»úÖƺ͹¹Ôì·½·¨Á´ÊµÏÖ

Ê×ÏÈÊÇÎÒÃÇÊìϤµÄextendº¯Êý 
/**
* À©Õ¹º¯Êý
* @param target À©Õ¹¶ÔÏó
* @param params À©Õ¹²ÎÊý
*/
function extend(target, params) {
if (!target) {
target = {};
}
for (var prop in params) {
target[prop] = params[prop];
}
r ......

JavaÖØдÓëÖØÔØ

ÖØдµÄÖ÷ÒªÓŵãÊÇÄܹ»¶¨Òåij¸ö×ÓÀàÌØÓеÄÌØÕ÷:
       Èç:
    public class Father
    {
             public void speak()
         &nb ......

DWRÖÐJava·½·¨µÄ²ÎÊý¼°·µ»ØÖµÉÏƪ

DWRÊÇÒ»¸ö¿ò¼Ü£¬¼òµ¥µÄ˵¾ÍÊÇÄܹ»ÔÚjavascriptÖ±½Óµ÷ÓÃjava·½·¨£¬¶ø²»±Øȥдһ´ó¶ÑµÄjavascript´úÂë¡£ËüµÄʵÏÖÊÇ»ùÓÚajaxµÄ£¬¿ÉÒÔʵÏÖÎÞË¢ÐÂЧ¹û¡£
ÍøÉÏÓв»ÉÙDWRµÄÀý×Ó£¬µ«´ó¶¼Ö»ÊÇijÖÖ·½·¨µÄµ÷Ó㬱¾ÎÄÖ»ÔÚʹÓòãÃæÉϽéÉÜDWR£¬²¢²»Éæ¸ü¶àµÄ¼¼ÊõÓëÉè¼Æ£¬ÆäÄ¿µÄÊÇÈóõѧÕßÄܹ»ºÜ¿ìµÄѧ»á¸÷ÖÖjava·½·¨ÔÚjavascriptÖÐÊÇÈçºÎµ ......

Java]JAVA»ñÈ¡Ïà¶Ô·¾¶ÎÊÌâµÄ½â¾ö

(ת£ºhttp://blog.csdn.net/alex197963/archive/2008/03/26/2219994.aspx)
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶:¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶,(URLºÍÎïÀí·¾¶)ÀýÈç:
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶.http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶.
¡¡¡¡Ïà¶Ô·¾¶:Ïà¶ÔÓëij¸ö» ......

java»·¾³±äÁ¿ÅäÖÃ[ÕûÀí]

JDKµÄ°²×°Â·¾¶
-------------
±äÁ¿Ãû JAVA_HOME
±äÁ¿ÖµÊ¾Àý D:\Program Files\Java\jdk1.6.0;
ËÑË÷ÀàµÄĿ¼
------------
±äÁ¿Ãû CLASSPATH
±äÁ¿ÖµÊ¾Àý D:\Program Files\Java\jdk1.6.0\lib\tools.jar;
    D:\Program Files\Java\jdk1.6.0\lib\dt.jar;
JdkµÄbinĿ¼
------------
±äÁ¿Ãû PATH(Ò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ