面试问题
重生之我是一名程序员
IN IT && WIN IT !
展开
-
mybatis 问题 Invalid bound statement
【代码】mybatis 问题 Invalid bound statement。转载 2023-09-18 09:05:42 · 47 阅读 · 0 评论 -
合并两个有序链表
合并两个有序链表public class LinkedListMerged { private class Node { private Node next; private int value; public Node(int value) { this.value = value; this.next = null; } } public Node merg转载 2020-05-11 22:53:01 · 123 阅读 · 0 评论 -
模拟ArrayList在多线程环境下线程不安全
模拟ArrayList在多线程环境下线程不安全public class UnSafeArrayList { public static void main(String[] args) { ArrayList<String> list = new ArrayList<>(); for (int i = 0; i < 30; i++) { new Thread(new Runnable() {转载 2020-05-11 22:50:07 · 226 阅读 · 0 评论 -
静态方法不依赋对象
静态方法不依赋对象public class StaticTest { public static void sayHi(){ System.out.println("invoke sayHi()..."); }}@Testpublic void staticTest(){// StaticTest staticTest = null;//转载 2017-11-26 09:56:40 · 125 阅读 · 0 评论 -
值传参和引用传参
值传参和引用传参问题 @Test public void referTest(){ String a = "a"; String b = "b"; StringBuilder A = new StringBuilder("A"); StringBuilder B = new StringBuilder("B");转载 2017-11-25 09:20:40 · 525 阅读 · 0 评论 -
java中类型转换优先顺序
由大到小需要强制转换,由小到大不需要 精度由小到大顺序:byte,short,char -> int -> long -> float -> double//compile successfloat method(){ int i=1; return i;}//compile errorint method2() { double i = 3.4d; //转载 2017-11-25 08:59:01 · 2351 阅读 · 0 评论 -
str1==str2和str1.equals(str2)的问题
问题: @Test public void stringTest(){ String str1 = "hello"; String str2 = "hello"; System.out.println("str1.equals(str2) : "+ str1.equals(str2)); System.out.println("转载 2017-11-18 14:41:03 · 7037 阅读 · 0 评论 -
对象初始化(一)
问题如下:public class SomeBean { private static int age = 30; private static String name = getInitName(); { System.out.println("code block init..."); } static { age = 40;原创 2017-11-13 09:11:07 · 220 阅读 · 0 评论