Groovy javaµÄºÃ»ï°é2
Groovy ÈëÃÅ
ÔÚÕâÒ»½ÚÖУ¬½«ÕæÕý¿ªÊ¼½øÐÐ Groovy ±à³Ì¡£Ê×ÏÈ£¬Ñ§Ï°ÈçºÎÇáËɵذ²×° Groovy£¨Í¨¹ý Eclipse Groovy ²å¼þ£©£¬È»ºó´ÓһЩÓÐÖúÓÚÁ˽â Groovy µÄ¼òµ¥Ê¾Àý¿ªÊ¼¡£
ÇáËÉ°²×° Groovy
ΪÁËѸËÙ¿ªÊ¼Ê¹Óà Groovy£¬ÐèÒª×öµÄÈ«²¿¹¤×÷¾ÍÊÇ°²×° Eclipse µÄ Groovy ²å¼þ¡£´ò¿ª Ecliplse3.4»ò3.5£¬ÔÚ Help ²Ëµ¥ÖÐÑ¡Ôñ Software Updates > Find and Install...¡£
½ÓÏÂÀ´£¬³öÏÖÒ»¸ö¶Ô»°¿ò£¬ÀïÃæ°üº¬Á½¸öÑ¡Ïî¡£ÇëÑ¡Ôñ Search for new features to install µ¥Ñ¡°´Å¥¡£µ¥»÷ Next °´Å¥£¬È»ºóÑ¡Ôñ New Remote Site...¡£³öÏÖÒ»¸öеĶԻ°¿ò£¬ÀïÃæ°üº¬Á½¸öÐèÒªÌîдµÄ×ֶΣºÐÂλÖõÄÃû³ÆºÍ¸ÃλÖÃµÄ URL£¬
ÊäÈë “Groovy plugin” ×÷ΪÃû³Æ£¬ÊäÈë “http://dist.codehaus.org/groovy/distributions/update/” ×÷ΪλÖ㬵¥»÷ OK °´Å¥£¬ÔÚËæºó³öÏÖµÄ Sites to include in search ¿òÖÐÈ·±£Ñ¡ÖÐÁËÃûΪ “Groovy plugin” µÄÏîÄ¿
µ¥»÷ Finish °´Å¥Ö®ºó£¬Ó¦¸Ã»á³öÏÖ Search Results ¶Ô»°¿ò¡£ÇëÔÙ´ÎÈ·¶¨Ñ¡ÖÐÁË “Groovy plugin” ¿ò²¢µ¥»÷ Next °´Å¥
¾¹ýһϵÁÐÈ·ÈÏÖ®ºó£¬½«»áÏÂÔزå¼þ£¬È»ºó¿ÉÄÜÐèÒªÖØÐÂÆô¶¯ Eclipse¡£
Èç¹ûÒ»ÇÐ˳ÀûµÄ»°£¬½«¿ÉÒÔÔÚEclipseÖд´½¨GroovyÏîÄ¿
----------------------------------------------------------------------
´´½¨ Groovy ÏîÄ¿
Eclipse ÖØÆôÖ®ºó£¬¾ÍÄܹ»´´½¨µÚÒ»¸ö Groovy ÏîÄ¿ÁË¡£ÇëÈ·±£´´½¨Á½¸öÔ´Îļþ¼Ð — Ò»¸ö³ÆΪ “groovy”£¬ÁíÒ»¸ö³ÆΪ “java”¡£±àдµÄ Groovy ´úÂë·ÅÔÚ groovy Îļþ¼Ð£¬Java ´úÂë·ÅÔÚ java Îļþ¼Ð¡£
Hello World! — Óà Groovy ±àдµÄ Java ³ÌÐò
µ¥»÷ Finish °´Å¥£¬Ó¦¸Ã»á¿´µ½ÈçÏÂËùʾµÄ´úÂë¶Î£º
class HelloWorld {
static void main(args) {
}
}
Õâ¿´ÆðÀ´Í¬Ç°ÃæµÄ Java HelloWorld ʾÀý¾ªÈ˵ØÏàËÆ¡£µ«ÊÇÇë×¢Ò⣬Ëü²»°üº¬ public Ð޸ķû¡£¶øÇÒ£¬Èç¹û×Ðϸ²é¿´ main ·½·¨µÄ²ÎÊý£¬»á×¢Òâµ½ËüûÓÐÀàÐÍ¡£
ÏÖÔÚÔÚ main ·½·¨ÄÚ¼ÓÈë println "Hello World"£¬Íê³ÉºóµÄ´úÂë¿´ÆðÀ´ÈçÏÂËùʾ£º
class HelloWorld {
static void main(args) {
println "Hello World"
}
}
ÔÚÔ´´úÂë±à¼Æ÷ÖÐÓ¦¸ÃÄܹ»ÓÒ¼üµ¥»÷£¬²¢Ñ¡Ôñ Compile Groovy File Ñ¡Ï
ÏÂÀ´£¬ÔÙ´ÎÓÒ¼üµ¥»÷Îļþ£¬Ñ¡Ôñ Run As Ñ¡ÏȻºóÑ¡Ôñ Groovy Ñ¡Ïî¡£ÔÚ Eclipse ¿ØÖÆ̨ÖÐÓ¦¸Ã»á¿´µ½Êä³öµÄ “Hello World”¡£
Groovy ʵ¼ÊÉ
Ïà¹ØÎĵµ£º
Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ ......
×ðÖØÔ´´£¬±¾Ìùת×Ô:http://longsy.javaeye.com/blog/382880
µ±Êý×é×÷Ϊ·½·¨´«µÝ²ÎÊýʱ£¬¼ÙÈçÐè´¦Àí´ËÊý×飬ÔòÒ»°ãÓÐÁ½ÖÖ×ö·¨£¨ÒÔһάÊý×éΪÀý£©:
//µÚÒ»ÖÖ
public static int[] processArray1(int[] array) {
int[] tempArr = new int[array.length];
for(int i=0; i<array.length; i++) {
......
JAIµÄÈ·ÊǸö²»´íµÄ¶«¶«£¬Í¼ÐÎäÖȾÉÏÌṩÁ˱ȽϺõÄÀà·â×°ÒÔ¼°¿çƽ̨ÐÔ¡£²»ÖªµÀΪºÎJAI¾ÍÔÚ2006ÄêÖ¹²½ÔÚ1.1.3µÄ°æ±¾ÏÂÁË£¬Äª·ÇSun(Oracle)ÕæµÄÈ¥×öJava 2DµÄ·á¸»È¥ÁË¡£ÔÝʱ»¹Ã»Óп´µ½Java 2D·½ÃæµÄ×ÊÁÏ£¬ÏÈ°ÑJAIµÄÄÚÈÝÌù³öÀ´¡£
ÏÂÔØJAI¿ÉÒÔÈ¥ÕâÀï http://download.java.net/media/jai/builds/release/1_1_3/
ÏëÒªÁ˽âËüµÄ° ......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄ³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò»Ñù£¬Õâ ......
дÈëʱ£¬ÏÈ×ö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 ......