易截截图软件、单文件、免安装、纯绿色、仅160KB

java:递归汉罗塔游戏最少的走法

package game;
public class HanTaGame {
 public static void main(String[] args) {
  fun('1', '2', '3', 2);
 }
 // 汉塔游戏解决方案
 public static void fun(char src, char idle, char dest, int n) {
  if (1 == n) {
   System.out.println(src + "--->" + dest);
   return;
  }
  //定义一个顺序
  fun(src, dest, idle, n - 1);
  System.out.println(src + "--->" + dest);
  //进行顺序的交换
  fun(idle, src, dest, n - 1);
 }
}


相关文档:

Java中集合容器类List和Set的用法

List的用法
List包括List接口以及List接口的所有实现类。因为List接口实现了Collection接口,所以List接口拥有Collection接口提供的所有常用方法,又因为List是列表类型,所以List接口还提供了一些适合于自身的常用方法,如表1所示。
表1  List接口定义的常用方法及功能
从表1可以看出,List接口提供的适合于自身的 ......

java:二分查找法

package arrays.compara;
/**
 *
 * @author Happy 二分查找法
 */
public class BinarySearch {
 public static void main(String[] args) {
  int[] arrInt = { 2, 34, 32, 24, 23, 34, 12, 3, 4, 2 };
  int index = bSearch(29, arrInt, 0, arrInt.length);
 & ......

java:三种经典大排序汇总,冒泡,插入,选择

package arrays.myArray;
public class SortArr {
 public static void main(String[] args) {
  int[] arrInt = { 4, 7, 8, 5, 6, 3, 2, 3, 4 };
  maoPaoSort(arrInt);
  print("冒泡排序:", arrInt);
  arrInt = new int[]{ 4, 7, 8, 5, 6, 3, 2, 3, 4 };
 & ......

java:递归:汉罗塔游戏计算出最少的步数

package game;
public class HanTa {
 public static int i = 0;
 public static void main(String[] args){
  calc('A', 'B', 'C', 2);
  System.out.println("最少需要"+i+"步。");
 }
 
 //汉罗塔游戏计算
 public static void calc(char src, char ilde, c ......

JAVA RMI 快速入门实例

JAVA RMI 快速入门实例
本实例为参考多篇文章写就而成,网上及书上各类文章介绍如何使用RMI有多种实例可参考,譬如有:
1. 用命令rmiregistry启动RMI注册服务的
2. 同时创建存根(stub)和骨架(skeleton)的
3. 只创建存根类的的(jdk1.2以后版本)
4. 通过RemoteRef和rmi://协议字串方式的
5. 比较少讲到的用LocateRegist ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号