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

¾­µäµÄÅ©·òÑøÅ£ÎÊÌ⣨JavaʵÏÖ£©

ÎÊÌâÃèÊö£ºÒ»¸öÅ©·òÑøÁËһͷţ£¬ÈýÄêºó£¬ÕâͷţÿÄê»áÉú³ö1Í·Å££¬Éú³öÀ´µÄÅ£ÈýÄêºó£¬ÓÖ¿ÉÒÔÿÄêÉú³öһͷţ……ÎÊÅ©·ò10ÄêºóÓжàÉÙÍ·Å£?nÄêÄØ£¿£¨ÓÃJAVAʵÏÖ£©
ÎÊÌâ½âÎö£º
1£©ÔÚÕâ¸öÎÊÌâÖУ¬Òª×¢ÒâÿͷţÉú²úµÄʱ¼ä£º
     µÚһͷţÈýÄêºó²Å»áÉú³öһͷеÄÅ££¨×¢ÒâÊÇÈýÄêºó£¬¶ø²»ÊǵÚÈýÄ꣩£¬½«Å©·ò¿ªÊ¼ÑøÅ£µÄʱ¼äµãÉèΪµÚ0Äꣻ
     ¿ÉÒÔÉèÖÃÒ»¸öÿһͷţµÄÄêÁ䣺age£¨³õʼֵµÈÓÚ0£©£¬µ±age>=3ºó£¬Ã¿Ò»ÄêÉú³öһͷСţ£»
2£©¶ÔÅ£µÄ¼ÆÊý£¬ÉèÖÃÒ»¸ö×ܵļÆÊýÆ÷count=1£¨Ô­ÏÈÓÐÅ£1Í·£©£»
3£©Õâ¸öÎÊÌâµÄ½â¾öÒªÓõ½µÝ¹é£ºµÚһͷţÈýÅ£ºóÿһÄêÉú³öһͷСţ£¬È»ºóСţµÄÐÐΪÓëËüµÄĸÇ×Ïàͬ£¨µÝ¹é£©£»
4£©×¢ÒâµÝ¹é³ÌÐòµÄ½áÊøÌõ¼þÅжϣºµ±×Üʱ¼äµ½´ïµÚ10Äêºó£¨µ±È»£¬Ò²¿ÉÒÔ×Ô¼ºÉ趨×Ô¼ºÐèÒªµÄʱ¼ä£©£¬µÝ¹é½áÊø£»
ÏÂÃæÊÇÎÒдµÄJava´úÂ룺
public class RaiseCowByRecursive { 
 
 public static void main(String[] args) {
  
  for (int i=0; i<=10; i++) {
   System.out.println("µÚ" + i + "Ä꣺" + "Å©·òËùÑøÅ£µÄ×ÜÊý£º" + getCows(i) + "Í·");
  }
  
 }//end main
 
 private static int getCows(int age) { //¸ù¾ÝÅ£µÄÄêÁäÀ´¼ÆËãÅ£µÄ×ÜÊý
  
  //1£©µ±Å£µÄÄêÁäСÓÚ3ʱ£¬Å©·òµÄÅ£µÄ×ÜÊýΪ1
  //2£©µ±Å£µÄÄêÁä´óÓÚµÈÓÚ3ʱ£¨±íʾÈýÄêºó£©£¬¸ÃţÿÄê²úÉú1Í·Å££¬²¢ÇÒ¼ÓÉÏËüËùÉúµÄÅ£µÄ×ÜÊý£¨µÝ¹é£©
  int countCows = 0;
  if (age < 3) {
   countCows = 1;
  } else {
   countCows = 1;
   for (int i=0; i<=age-3; i++) {
    countCows += getCows(i);
   }
  }//end if-else
  return countCows;  
 }//end getCows
}


Ïà¹ØÎĵµ£º

JavaÔÚ²»Í¬»·¾³Ï»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨

JavaÔÚ²»Í¬»·¾³Ï»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨
¹Ø¼ü×Ö: javaÔÚ²»Í¬»·¾³Ï»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨
1. ÔÚServlet\FilterµÈServlet web»·¾³ÖУ¬Ö»Òª»ñµÃjavax.servlet.ServletContextÀàÐÍ£¬Ôò¿ÉÒÔͨ¹ý getRealPath("...") »ñµÃ·¾¶¡£Ïà¶Ô·¾¶ÖÐ×²ãĿ¼¿Éͨ¹ý²ÎÊý“"/"”»ñÈ¡¡£
request.getSession().getServletContext() ......

Java Reflection JAVA·´Éä

Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐÔ¡£ÀýÈ磬ʹÓÃËüÄÜ»ñµÃ Java ÀàÖи÷³ÉÔ±µÄÃû³Æ²¢ÏÔʾ³öÀ´¡£
Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ²ÐíÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäËüµÄ³ÌÐòÉè¼ÆÓïÑÔÖиù±¾¾Í²»´æÔÚÕâÒ»ÌØÐÔ¡£ÀýÈ磬Pascal¡¢C ......

ÌáÈ¡ÍøÒ³µÄͼƬÁ´½ÓµÄJava³ÌÐò

ÊäÈëÍøÒ³ÎļþÃû£¬ºÍ×ÊÔ´ÁбíÎļþÃû
Êä³ö×ÊÔ´ÁбíÎļþ¹©Ñ¸À×ÏÂÔØ¡£
ÊÊÓÃÓÚÅúÁ¿ÏÂÔØͼƬ¡£
ÓÉÁ½¸öÎļþ×é³É¡£
ûÓÐÌṩÍøÒ³ÏÂÔع¦ÄÜ£¬ÒòΪÎÒûÓÐʱ¼äд£¬Ïà¹ØµÄ´úÂëÒÔºóÔÙÌù¡£
 1
//
AnalizeIMG.java
 2
 3
//
Ö÷³ÌÐò
 4
 5
import
 java.io.BufferedReader;
 6
import
......

javaÖеĶÔÏó¸³ÖµÎÊÌâ

ÔÚjavaÖР ¿ÉÒÔ½«Ä³¸ö¶ÔÏó¸³Öµ¸øÁíÒ»¸ö¶ÔÏó  Ö»Òª¸ÃÁ½¸ö¶ÔÏóÊÇÊôÓÚͬһ¸öÀ༴¿É  ´Ëʱ  ÕâÁ½¸ö¶ÔÏóµÄËùÓгÉÔ±½«Ö¸Ïòͬһ¿éÄÚ´æ
eg£º
      public class class1
         {
        &n ......

JAVA²Ù×÷windows×¢²á±í


ÔÚÎÒÃÇд³ÌÐòµÄʱºò,ÓÐʱ»áÒªÇó±£´æһЩÊý¾Ý,±ÈÈçÓû§Ãû»òÕß±ðµÄ,µ«ÊÇÕâÑùÊý¾ÝÓÖ²»ÊDZ£´æÔÚ³ÌÐòͬһĿ¼ÏÂ,ÕâÑù×öÌ«Ã÷ÏÔÁË,Ò²²»Ì«°²È«,ÄÇÔõô°ìÄØ?Õâ¸öʱºò,Èç¹ûÄÜ°ÑÊý¾Ý±£´æµ½×¢²á±íÀïÃæÈ¥,ÄǸöàºÃ,Ò»À´Òþ±Î,¶þÀ´·½±ã,²»ÖÁÓÚÔÚ³ÌÐòĿ¼ÏÂÉú³ÉÒ»´óƬÎļþ.
ÔÚJAVAÀïÃæ,¿ÉÒÔÀûÓÃjava.util.prefs.PreferencesÀ´¶Ô×¢²á±í½øÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ