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

Groovy javaµÄºÃ»ï°é4

ºÜ¿ÉÄܽ« Groovy µ±³ÉÊÇûÓйæÔòµÄ Java ´úÂë¡£µ«Êµ¼ÊÉÏ£¬Groovy Ö»ÊǹæÔòÉÙһЩ¡£ÕâÒ»½ÚµÄÖصãÊÇʹÓà Groovy ±àд Java Ó¦ÓóÌÐòʱ¿ÉÒÔ²»Óÿ¼ÂǵÄÒ»¸ö Java ±à³ÌµÄ¾ßÌå·½Ã棺ÀàÐͶ¨Òå¡£
ΪʲôҪÓÐÀàÐͶ¨Ò壿
ÔÚ Java ÖУ¬Èç¹ûÒªÉùÃ÷Ò»¸ö String ±äÁ¿£¬Ôò±ØÐëÊäÈ룺
String value = "Hello World";
µ«ÊÇ£¬Èç¹û×ÐϸÏëÏ룬¾Í»á¿´³ö£¬µÈºÅÓÒ²àµÄ×Ö·ûÒѾ­±íÃ÷ value µÄÀàÐÍÊÇ String¡£ËùÒÔ£¬Groovy ÔÊÐíÊ¡ÂÔ value Ç°ÃæµÄ String ÀàÐͱäÁ¿£¬²¢Óà def ´úÌæ¡£
def value = "Hello World"
ʵ¼ÊÉÏ£¬Groovy »á¸ù¾Ý¶ÔÏóµÄÖµÀ´ÅжÏËüµÄÀàÐÍ¡£
½« HelloWorld.groovy ÎļþÖеĴúÂë±à¼­³ÉÏÂÃæÕâÑù£º
String message = "Hello World"
println message
ÔËÐÐÕâ¶Î´úÂ룬Ӧ¸Ã»áÔÚ¿ØÖÆ̨ÉÏ¿´µ½ÓëÇ°ÃæÒ»ÑùµÄ “Hello World”¡£ÏÖÔÚ£¬½«±äÁ¿ÀàÐÍ String Ì滻Ϊ def ²¢ÖØÐÂÔËÐдúÂë¡£ÊDz»ÊÇ×¢Òâµ½ÁËÏàͬµÄ½á¹û£¿
³ýÁËÊä³ö message µÄÖµ£¬»¹¿ÉÒÔÓÃÒÔϵ÷ÓÃÊä³öËüµÄÀàÐÍ£º
def message = "Hello World"
println message.class
Êä³ö “class java.lang.String” Ó¦¸ÃÊÇĿǰΪֹºÜÊÜ»¶Ó­µÄÒ»Ïî±ä»¯£¡
Èç¹ûÏëÖªµÀµ½µ×·¢ÉúÁËʲô£¬ÄÇô¿ÉÒÔ¸æËßÄú£ºGroovy Íƶϳö message Ò»¶¨ÊÇ String ÀàÐ͵ģ¬ÒòΪËüµÄÖµÊÇÓÃË«ÒýºÅÀ¨ÆðÀ´µÄ¡£
ÀàÐÍÍƶϵĸü¶àÄÚÈÝ
Äú¿ÉÄÜÌý˵¹ý£¬ÔÚ Groovy ÖÐ “Ò»Çж¼ÊǶÔÏó” — µ«¶ÔÓÚÀàÐÍÀ´ËµÕâ¾ä»°Òâζ×ÅʲôÄØ£¿ÈÃÎÒÃÇ¿´¿´Èç¹û½«Ç°ÃæʾÀýÖÐµÄ String Ì滻ΪÊý×Ö»áÔõôÑù£¬ÈçÏÂËùʾ£º
def message = 12
println message.class
message ±äÁ¿µÄÊý×ÖÖµ¿´ÆðÀ´ÏñÊÇ Java µÄÔ­ÉúÀàÐÍ int¡£µ«ÊÇ£¬ÔËÐÐÕâ¸ö´úÂë¾Í¿ÉÒÔ¿´³ö£¬Groovy ½«Ëü×÷Ϊ Integer¡£ÕâÊÇÒòΪÔÚ Groovy ÖÐ “Ò»Çж¼ÊǶÔÏó”¡£
Java ÖеÄËùÓжÔÏó¶¼À©Õ¹×Ô java.lang.Object£¬Õâ¶Ô Groovy À´Ëµ·Ç³£·½±ã¡£¼´Ê¹ÔÚ×îÔãµÄÇé¿öÏ£¬Groovy ÔËÐÐʱ²»ÄÜÈ·¶¨±äÁ¿µÄÀàÐÍ£¬ËüÖ»Ð轫±äÁ¿µ±³É Object£¬ÎÊÌâ¾Í½â¾öÁË¡£
¼ÌÐøʹÓÃÕâ¶Î´úÂë¡£½« message ¸Ä³É×Ô¼ºÏ²»¶µÄÈÎÒâÀàÐÍ£ºGroovy »áÔÚÔËÐÐʱ¾¡ÆäËùÄÜÍƶϳöÕâ¸ö±äÁ¿µÄÀàÐÍ¡£
ÎÞÀàÐÍÓÐʲôÒâÒå
ÄÇô£¬Groovy ȱÉÙÀàÐÍÒâζ×ÅËùÐèµÄÊäÈë¸üÉÙ¡£²»¿É·ñÈÏ£¬½« String Ìæ»»³É def ²¢Ã»ÓÐÕæÕý½ÚÔ¼¶àÉÙ´ò×Ö¹¤×÷ — Èý¸ö×Öĸ²¢²»ÖµµÃÈçºÎ¿äÒ«£¡µ«ÊÇÔÚ¸ü¸ßµÄ²ã´ÎÉÏ¿´£¬ÔÚ±àд´óÁ¿²»½ö½ö°üº¬±äÁ¿ÉùÃ÷µÄ´úÂëµÄʱºò£¬Ã»ÓÐÀàÐÍȷʵ¼õÉÙÁËÐí¶à´ò×Ö¹¤×÷¡£¸üÖØÒªµÄÊÇ£¬ÕâÒâζ×ÅÒªÔĶÁµÄ´úÂëÒªÉٵöࡣ


Ïà¹ØÎĵµ£º

IBM FileNet Content Java API ¼ò½é

2008 Äê 6 ÔÂ 24 ÈÕ
Ô­ÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......

JavaÖÐÏ̵߳ĸ߼¶Ó¦ÓÃ

Ò»¡¢Java¶àÏ̻߳¥³â¼°Í¬²½¿ØÖƺÍͨÐÅ
    ¶à¸öÏ̵߳ÄÖ´ÐÐÊDz¢·¢µÄ£¬Ò²¾ÍÊÇÔÚÂß¼­Éϓͬʱ”£¬¶ø²»¹ÜÊÇ·ñÊÇÎïÀíÉϵēͬʱ”¡£Èç¹ûϵͳֻÓÐÒ»¸öCPU£¬ÄÇôÕæÕýµÄ“ͬʱ”ÊDz»¿ÉÄܵģ¬µ«ÊÇÓÉÓÚCPUµÄËٶȷdz£¿ì£¬Óû§¸Ð¾õ²»µ½ÆäÖеÄÇø±ð£¬Òò´ËÎÒÃÇÒ²²»ÓùØÐÄËü£¬Ö»ÐèÒªÉèÏë¸÷¸öÏ ......

java¶ÁÈ¡mysqlÊý¾Ý¿âlatin1±ÜÃâÂÒÂë·½·¨

дÈëʱ£¬ÏÈ×öencode£º
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
¶Á³öʱ£¬ÔÙ×ödecode£º
public static String deco ......

Java SEѧϰ_String[] split(String regex)_×¢ÒâÊÂÏî


String[] split(String regex)
    ¸ù¾Ý¸ø¶¨µÄÕýÔò±í´ïʽµÄÆ¥ÅäÀ´²ð·Ö´Ë×Ö·û´®£¬javaÖÐʹÓÃregexµÄ·ûºÅÐèҪʹÓÃ"\\"£¬ÒòΪregex±¾ÉíʹÓÃ"\"×÷ΪתÒå·û¡£¶øÔÚjavaÖÐÒ»¸ö"\"£¬ÐèÒªÓÃ"\\"±íʾ¡£
    Èç¹ûÓÃ"."×ö·Ö¸îµÄ»°±ØÐëÒªÕâÑù"\\."Èç¹ûÊÇ|Ò²ÊÇ"\\|"¡£
Áоټ¸¸öʵÓÃ"\\"µÄÀý×Ó£º
Stri ......

Groovy javaµÄºÃ»ï°é3

Groovy ±äÉíΪ Java
Ç°ÃæÒѾ­¿´µ½ Groovy Óë Java ´úÂëʵ¼ÊÉÏ¿ÉÒÔ»¥»»µÄµÚÒ»¸öÖ¤¾Ý¡£ÕâÒ»½Ú½«½øÒ»²½Ö¤Ã÷Õâµã£¬¼ÌÐøʹÓà Groovy ¹¹½¨µÄ HelloWorld Àà¡£
Hello, Java!
ΪÁËʹÄúÈ·ÐÅ Groovy ¾ÍÊÇ Java£¬ÏÖÔÚÔÚ HelloWorld ÀàÉùÃ÷ºÍ·½·¨ÉùÃ÷Ç°Ãæ¼ÓÉÏ public Ð޸ķû£¬ÈçÏÂËùʾ£º
public class HelloWorld {
public static ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ