JavaÓÃforÑ環Map
¸ù¾ÝJDK5µÄÐÂÌØÐÔ,ÓÃForÑ»·Map,ÀýÈçÑ»·MapµÄKey
Java´úÂë
for(String dataKey : paraMap.keySet()) {
System.out.println(dataKey );
}
for(String dataKey : paraMap.keySet()) {
System.out.println(dataKey );
}
×¢ÒâµÄÊÇ,paraMap ÊÇÔõôÑù¶¨ÒåµÄ,Èç¹ûÊǼòµ¥µÄMap paraMap = new HashMap ();ÄÇÇ°ÃæµÄString¾ÍÖ»ÄÜ»»³ÉObjectÁË.
Ñ環Õû個mapµÄkeyºÍvalue
Java´úÂë
Map<Integer,String> map = new LinkedHashMap<Integer,String>();
map.put(1, "ÐÇÆÚÒ»");
map.put(2, "ÐÇÆÚ¶þ");
map.put(3, "ÐÇÆÚÈý");
map.put(4, "ÐÇÆÚËÄ");
map.put(5, "ÐÇÆÚÎå");
map.put(6, "ÐÇÆÚÁù");
map.put(7, "ÐÇÆÚÈÕ");
for(Map.Entry<Integer, String> entry: map.entrySet()) {
System.out.print(entry.getKey() + ":" + entry.getValue() + "\t");
}
Map<Integer,String> map = new LinkedHashMap<Integer,String>();
map.put(1, "ÐÇÆÚÒ»");
map.put(2, "ÐÇÆÚ¶þ");
map.put(3, "ÐÇÆÚÈý");
map.put(4, "ÐÇÆÚËÄ");
map.put(5, "ÐÇÆÚÎå");
map.put(6, "ÐÇÆÚÁù");
map.put(7, "ÐÇÆÚÈÕ");
for(Map.Entry<Integer, String> entry: map.entrySet()) {
System.out.print(entry.getKey() + ":" + entry.getValue() + "\t");
}
輸³ö結¹û£º
1:ÐÇÆÚÒ» 2:ÐÇÆÚ¶þ 3:ÐÇÆÚÈý 4:ÐÇÆÚËÄ 5:ÐÇÆÚÎå 6:ÐÇÆÚÁù 7:ÐÇÆÚÈÕ
Ïà¹ØÎĵµ£º
1.дһ¸ö·½·¨£¬ÓÃÒ»¸öforÑ»·´òÓ¡¾Å¾Å³Ë·¨±í
/**
* ´òÓ¡¾Å¾Å³Ë·¨¿Ú¾÷±í
*/
public void nineNineMulitTable(){
for (int i = 1,j = 1; j <= 9; i++) {
System.out.print(i+"*"+j+"="+i*j+" ");
if(i==j){
i=0;
......
javaÖÐʱ¼ä´ÁºÍʱ¼ä×Ö·û´®Ö®¼äµÄת»»
»ñÈ¡µ±Ç°µÄunixʱ¼ä´Á
new Date().getTime()
System.currentTimeMillis()
·µ»ØµÄÊǺÁÃëÊý£¬Òª×ª»»long t = System.currentTimeMillis()/1000;
»ñÈ¡µ±Ç°ÄêÔÂÈÕÒÔ¼°Ê±·ÖÃë
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR)) c.get(Calendar.YEAR)) c.get(C ......
Ò»¡¢PythonÖеÄÎļþ¹ÜÀí
Îļþ¹ÜÀíÊǺܶàÓ¦ÓóÌÐòµÄ»ù±¾¹¦ÄܺÍÖØÒª×é³É²¿·Ö¡£Python¿ÉÒÔʹÎļþ¹ÜÀí¼«Æä¼òµ¥£¬ÌرðÊÇºÍÆäËüÓïÑÔÏà¶Ô±È¡£
ÒÔÏ£¬Peyton McCullough½²½âÁËÎļþ¹ÜÀí»ù´¡¡£
½éÉÜ
ÄãÍæ¹ýµÄÓÎϷʹÓÃÎļþÀ´±£´æ´æµµ£»ÄãÏµĶ©µ¥±£´æÔÚÎļþÖУ»ºÜÃ÷ÏÔ£¬ÄãÔçÉÏдµÄ±¨¸æÒ²±£´æÔÚÎļþÖС£
¼¸ºõÒÔÈκÎÓïÑÔ±àдµÄÖÚ¶àÓ ......
1¡¢JAVA¶ÁÈ¡Îļþ£¬±ÜÃâÖÐÎÄÂÒÂë¡£
/**
* ¶ÁÈ¡ÎļþÄÚÈÝ
*
* @param filePathAndName
* String Èç c:\\1.txt ¾ø¶Ô·¾¶
* @return boolean
*/
public static String readFile(String filePathAndName) {
String fileContent ......
java¼¯ºÏ¿ò¼Üͼ¼°½éÉÜ
ת×Ô:http://hi.baidu.com/%C9%AE_%CC%C6/blog/item/9e2a8b0887008a8ad0581b3d.html
¼ò»¯Í¼£º
Javaƽ̨ÌṩÁËÒ»¸öÈ«Ðµļ¯ºÏ¿ò¼Ü¡£“¼¯ºÏ¿ò¼Ü”Ö÷ÒªÓÉÒ»×éÓÃÀ´²Ù×÷¶ÔÏóµÄ½Ó¿Ú×é³É¡£²»Í¬½Ó¿ÚÃèÊöÒ»×鲻ͬÊý¾ÝÀàÐÍ¡£
Java 2¼¯ºÏ¿ò¼Üͼ
¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í ......