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

javaµÝ¹éʵÏÖººÅµËþ

/*
 * ººÅµËþ£¬´ÓµÚ1¸öÖù×Ó½èÖúµÚ2¸ùÖù×ÓÒÆ¶¯µ½µÚ3¸ù
 */
public class TowerOfHano {
 
    private int totle;//×ܹ²ÅÌ×ÓÊýÄ¿
    public TowerOfHano(int totle){
       this.totle=totle;
    }
    private void moveOne(int start,int end){
       System.out.println("´Ó"+start+"ÒÆ¶¯Ò»¿éÅÌ×Óµ½"+end);
    }
    private void moveAll(int totle,int start,int temp,int end){
      
       if(totle==1){
           moveOne(start,end);
       }else{
          
           moveAll(totle-1,start,end,temp);
           moveOne(start,end);
           moveAll(totle-1,temp,start,end);
       }
    }
    public static void main(String[] args) {
       TowerOfHano tower = new TowerOfHano(3);//²âÊÔÈý¿éÅÌ×Ó
       tower.moveAll(tower.totle, 1, 2, 3);
    }
}
 
 


Ïà¹ØÎĵµ£º

javaÖÐthisºÍsuperµÄÓ÷¨

thisµÄÓ÷¨ÔÚjavaÖдóÌå¿ÉÒÔ·ÖΪ3ÖÖ£º
 //1.ÆÕͨµÄÖ±½ÓÒýÓÃ
class test {
   private int x,y;
   public test(int x,int y) {
       setX(x);//Ò²¿ÉÒÔдΪthis.setX(x);ÕâÖÖÇé¿öÏÂthis¿ÉÒÔÊ¡ÂÔ.
   }
}
//2.·½·¨ÖеÄij¸öÐβÎÃûÓ뵱ǰ¶ÔÏóµÄÄ ......

javaÖлñµÃÊý×éÖÐ×îСµÄÊý

public static void main(String[] args)
{
Integer[] arrInt = new Integer[6];
arrInt[0] = 123;
arrInt[1] = 3453;
arrInt[2] = 345;
arrInt[3] = 23;
arrInt[4] = 11;
arrInt[5] = 345;

int temp = 0;
for (int i ......

JAVA»ù±¾±äÁ¿µÄ¼¸µãÈÏʶ

     JAVAÖлù±¾±äÁ¿¹²°üÀ¨£ºbyte,short,int,long,float,double,char,boolean,ÔÚ³ÌÐòÖÐÓõÄ×îÆÕ±é£¬×î¶à£¬µ«ÊÇËüÃǵÄһЩ¹Ø¼üÒ²¾­³£±»ÎÒÃÇËùºöÂÔ£¬ÎÒ½ñÌì×ܽáÁËһϣ¬ÌùÔÚÕâÀï¡£¡£¡£
   
1.
±äÁ¿¶¨Ò壺
Ò»¸öÓɱêʶ·û¶¨ÒåµÄÊý¾ÝÏ°üÀ¨ÀàÐÍ¡¢Ãû³ÆºÍÖµÈý¸ö²¿·Ö
2.
±äÁ¿·ÖÀࣺ
Àà ......

Java·ÖÒ³£¨Ö§³Ö¶àÖÖÊý¾Ý¿â£©

×î½üÑо¿ÁËÏ·ÖÒ³£¬×ö¸ö×ܽᡣ
1£©Êý¾Ý¿â²Ù×÷Àà,×ö¼òµ¥·â×° DB.java
package Test;
import java.sql.*;
public class DB {
 
 // ¼ÓÔØÇý¶¯
    static {
        try {
            Class.f ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ