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

java±éÀú¶ÔÏó


JDK1.4ÖÐ
Map map = new HashMap();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object value = entry.getValue();
}
JDK1.5ÖÐ,Ó¦ÓÃÐÂÌØÐÔFor-EachÑ­»·
Map m = new HashMap();
for(Object o : map.keySet()){
map.get(o);
}
·µ»ØµÄ set ÖеÄÿ¸öÔªËض¼ÊÇÒ»¸ö Map.Entry ÀàÐÍ¡£
private Hashtable<String, String> emails = new Hashtable<String, String>();
  ÁíÍâ ÎÒÃÇ¿ÉÒÔÏÈ°ÑhashMap תΪ¼¯ºÏCollection£¬ÔÙµü´úÊä³ö£¬²»¹ýµÃµ½µÄ¶ÔÏó
//·½·¨Ò»: ÓÃentrySet()
Iterator it = emails.entrySet().iterator();
while(it.hasNext()){
Map.Entry m=(Map.Entry)it.next();
logger.info("email-" + m.getKey() + ":" + m.getValue());
}

// ·½·¨¶þ£ºjdk1.5Ö§³Ö£¬ÓÃentrySet()ºÍFor-EachÑ­»·()
for (Map.Entry<String, String> m : emails.entrySet()) {

logger.info("email-" + m.getKey() + ":" + m.getValue());
}

// ·½·¨Èý£ºÓÃkeySet()
Iterator it = emails.keySet().iterator();
while (it.hasNext()){
String key;
key=(String)it.next();
logger.info("email-" + key + ":" + emails.get(key));
}
// ·½·¨Î壺jdk1.5Ö§³Ö£¬ÓÃkeySEt()ºÍFor-EachÑ­»·
for(Object m: emails.keySet()){
logger.info("email-" + m+ ":" + emails.get(m));
}
      Map    aa    =    new    HashMap();     
 aa.put("tmp1",    new    Object());    
  //×·¼Ó      Ìæ»»ÓÃͬÑùµÄº¯Êý.     
aa.remove("temp1");                       
 //ɾ³ý     
 for    (Iterator    i    =    aa.values().iterator


Ïà¹ØÎĵµ£º

java µ÷ÓÃdllÎļþ

//1.´´½¨testdll.javaÎļþ
public class testdll
{
static
{
System.loadLibrary("goodluck");
}
public native static int get();
public native static void set(int i);
public static void main(String[] args)
{
testdll test = new testdll();
test.set(10);
System.out.println(test.get() ......

JAVA·´Éä»úÖƼ°CLASS.FORNAMEµÄ×÷Óü°º¬Òå

Reflection ÊÇJava±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ¡£Õâ¸ö»úÖÆÔÊÐí³ÌÐòÔÚÔËÐÐʱ͸¹ýReflection APIsÈ¡µÃÈκÎÒ»¸öÒÑÖªÃû³ÆµÄclass
µÄÄÚ²¿ÐÅÏ¢£¬°üÀ¨Æämodifiers£¨ÖîÈçpublic, static µÈµÈ£©¡¢superclass£¨ÀýÈçObject£©¡¢ÊµÏÖÖ®interfaces£¨ÀýÈçCloneable£©£¬Ò²°üÀ¨fields
ºÍmethodsµÄËùÓÐÐÅÏ ......

ÈçºÎ»ñÈ¡javaÀàÖеıäÁ¿ÃûµÄ×Ö´®

ÔÚÀàÖж¨ÒåÁËÒ»¸öÊôÐÔabc£¬ÈçºÎ»ñÈ¡Õâ¸ö±äÁ¿µÄabcµÄÃû×Ö´®ÄØ£¿Ò²¾ÍÊÇ˵Ôõô֪µÀabcÕâ¸ö±äÁ¿µÄÃû×ÖÊÇabc£¬Õâ¸öÎÊÌâ±È½ÏµÄºÃÍæ¡£
Õâ¸öÊÇżÔÚÒ»¿ª·¢ÖÐÓöµ½µÄÒ»¸ö±È½ÏÓÐȤµÄÎÊÌ⣬ÕÒ ÁË°ëÌìµÄ×ÊÁϼÓÏÂżÐÁÇÚµÄ˼¿¼£¬ÖÕÓÚÕÒµ½µÄ½â¾ö·½·¨¡£Ó÷´Éä¡«¡«¡«
javaÌṩÁ˺ÜÇ¿´óµÄ·´Éä»úÖÆ£¬¿ÉÒÔ˵±È¶¯Ì¬ÓïÑÔ»¹¶¯Ì¬¡£µ«ÊÇÕâ¸ö¶«¶«Æ½Ê±µ ......

javaÉú³Éxml¸ñʽÊý¾Ý

//»ñÈ¡Êý¾Ý¿âÊý¾Ý·µ»Ølist
public List queryAll(int fcateId) {
List list = new ArrayList();
String sql = "select * from g_Account where fCateID=? order by fCode";
Connection con = SqlHelp.getConn();//»ñµÃÁ¬½Ó£¬sqlhelp×Ô¼ºÐ´µÄ¹¤¾ßÀà
PreparedStatement pst = null;
ResultSet rs = null;
......

³õѧJava ϹдһµÀ Ò»Çж¼ÊǸ¡ÔÆ


import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Test {
 /**
  * @×÷ÕßQQ£º351828554 2009/12/01 ÐÇÆÚ¶þ
     version:1.0
  */
 public static void main(String[] args) {
        new encry ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ