随笔 - 18
文章 - 0
评论 - 2
阅读 -
92462
随笔分类 - 基础
==和equals深入解析
摘要:先抛个问题 int i = 0; double d = 0d; Integer integer = 0; Double dDouble = 0d; String str = "test"; StringBuilder sb = new StringBuilder("test"); Student s
阅读全文
ArrayList遍历的三种方式
摘要:1 public class ArrayListTraversal { 2 public void arrayListTraversal(List<Integer> lists){ 3 /* 第一种遍历方式 */ 4 System.out.print("for循环的遍历方式:"); 5 for (i
阅读全文
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
阅读全文
++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 >
阅读全文
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.
阅读全文
静态代码块、非静态代码块、构造函数的输出顺序
摘要:情况一:没有继承父类时 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 {
阅读全文
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_
阅读全文
自己实现ArrayList
摘要:1 public class ArrayList { 2 private final int MAXSIZE = 10; 3 private int[] arrays; 4 private int size = 0; 5 6 public ArrayList() { 7 arrays = new i
阅读全文