随笔 - 18  文章 - 0  评论 - 2  阅读 - 92462 
04 2017 档案
数组行列交换
摘要:1 public class ArrayChange { 2 /** 3 * 数组行和列变换的方法 4 * 5 * @param array 6 * 需要chang的数组 7 * @return chang以后的数组 8 */ 9 public int[][] change(int[][] arra 阅读全文
posted @ 2017-04-20 17:10 呵呵静 阅读(2139) 评论(0) 推荐(0) 编辑
判断括号匹配的程序
摘要:1 public class Match { 2 public boolean match(String expression) { 3 char[] array = expression.toCharArray(); 4 char[] stack = new char[array.length]; 阅读全文
posted @ 2017-04-19 22:57 呵呵静 阅读(1022) 评论(0) 推荐(0) 编辑
final、finally和finalize;throw和throws;collection和collections;==和equals;Statement和PrepareStatement
摘要:1、final、finally和finalize的区别 final:修饰class时,说明该class不能被继承;修饰方法时说明该方法不能被重写;修饰变量时,说明该变量一旦赋值则不能再修改 finally:用于异常处理,用来修饰一个代码块,其语义为最后地,表示该代码块中的代码一定会执行,通常用来释放 阅读全文
posted @ 2017-04-19 22:55 呵呵静 阅读(376) 评论(0) 推荐(0) 编辑
ArrayList遍历的三种方式
摘要:1 public class ArrayListTraversal { 2 public void arrayListTraversal(List<Integer> lists){ 3 /* 第一种遍历方式 */ 4 System.out.print("for循环的遍历方式:"); 5 for (i 阅读全文
posted @ 2017-04-17 22:05 呵呵静 阅读(56327) 评论(0) 推荐(1) 编辑
byte类型的127+1=-128?
摘要:1 public class Test2 { 2 public void add(Byte b) { 3 b = b++; 4 } 5 6 public void test() { 7 Byte a = 127; 8 Byte b = 127; 9 add(++a); 10 System.out.p 阅读全文
posted @ 2017-04-14 12:46 呵呵静 阅读(7249) 评论(1) 推荐(1) 编辑
++x和x++以及&&的逻辑问题
摘要:1 public class Test3 { 2 public static void main(String[] args) { 3 int x = 0; 4 int y = 0; 5 int k = 0; 6 for (int z = 0; z < 5; z++) { 7 if ((++x > 阅读全文
posted @ 2017-04-14 12:42 呵呵静 阅读(646) 评论(0) 推荐(0) 编辑
catch、finally语句块输出顺序
摘要:public class Test { public int add(int a, int b) { try { return a / b; } catch (Exception e) { System.out.println("catch语句块"); } finally { System.out. 阅读全文
posted @ 2017-04-14 12:39 呵呵静 阅读(1103) 评论(0) 推荐(0) 编辑
静态代码块、非静态代码块、构造函数的输出顺序
摘要:情况一:没有继承父类时 1 class HelloA { 2 3 public HelloA() { 4 System.out.println("I'm A class"); 5 } 6 7 static { 8 System.out.println("static A"); 9 } 10 11 { 阅读全文
posted @ 2017-04-14 12:35 呵呵静 阅读(2186) 评论(0) 推荐(0) 编辑
字符串逆置的两种方法
摘要:1 public class ReverseString { 2 3 /** 4 * 字符串指定逆置 5 * 6 * @param str 7 * 字符串 8 * @param start 9 * 开始下标 10 * @param end 11 * 结束下标 12 * @return chsr数组 阅读全文
posted @ 2017-04-13 22:41 呵呵静 阅读(4202) 评论(0) 推荐(0) 编辑
Stack栈的基础实现
摘要:1 public class Stack { 2 private final int INIT_SIZE = 10; 3 private int size = 0; 4 private int[] array; 5 6 public Stack() { 7 array = new int[INIT_ 阅读全文
posted @ 2017-04-13 21:48 呵呵静 阅读(296) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示