摘要:
1、基本型和基本型封装型进行“==”运算符的比较,基本型封装型将会自动拆箱变为基本型后再进行比较,因此Integer(0)会自动拆箱为int类型再进行比较,显然返回true; int a = 220; Integer b = 220; System.out.println(a==b);//true 阅读全文
摘要:
方法一: 该方法不需要重新创建新的数组可以直接遍历 public class TestCopy { public static void main(String[] args){ ArrayList<String> list = new ArrayList<>(); list.add("张三"); 阅读全文
摘要:
// 快速排序方法public void quickSort(int[] arr,int left,int right){ if (left > right){ return; } // 定义变量保存基准数 int base = arr[left]; // 定义变量,指向最左边 int i = le 阅读全文
摘要:
题目一 任务:将字符串中间的字符(除头尾外的其他字符)反转, 如"abc123"中的bc12反转再拼接a3,变成 a21cb3 public class work { public static void main(String[] args) { String str = "abc123"; re 阅读全文