2010年5月27日

几个二分法示例

摘要: /*** 几个二分法* @author tiger*/public class Test {/** * 中间调用多个自身方法 */public void erFenFa(int[] array, int fromIndex, int toIndex, int goal){if(fromIndex > toIndex){ // 这一句非常重要!return;}int middle = (fromIndex + toIndex) / 2;if(array[middle] == goal){System.out.println(goal + "在数组中的索引是:" + mi 阅读全文

posted @ 2010-05-27 19:12 台哥编程课堂 阅读(240) 评论(0) 推荐(0) 编辑

标点引起的一个程序错误

摘要: //今天发现个问题,十分怪异的。//检查了半天才发现是多写了个标点";". 晕!public class tiger {public static void main(String[] args) {if(2 > 1){System.out.println("hehehehe");}// 因为这里多加了一个分号 ";" ,以致还是会打印hehehehe.// 所以:写代码一定要小心!检查代码一定要仔细!if(1 > 2);{System.out.println("hehehehe");}//如此括号内的 阅读全文

posted @ 2010-05-27 19:11 台哥编程课堂 阅读(150) 评论(0) 推荐(0) 编辑

导航