package cn.temptation;

 public class Sample01 {
public static void main(String[] args) {
// 需求:小店对自己的销售额按季度进行统计,2016年各个季度统计如下:
// 第1季度:1月---10k 2月---12k 3月---9k
// 第2季度:4月---10k 5月---12k 6月---9k
// 第3季度:7月---10k 8月---12k 9月---9k
// 第4季度:10月---10k 11月---12k 12月---9k // 考虑使用合适的数据类型来存储数据,因为每个季度中的每个月都记录下来的是其销售额,所以每个月记录的都是相同意义的数据
// 考虑使用数组存储
// 第1季度:int[] sale1 = { 10, 12, 9 };
// 第2季度:int[] sale2 = { 10, 12, 9 };
// 第3季度:int[] sale3 = { 10, 12, 9 };
// 第4季度:int[] sale4 = { 10, 12, 9 }; // 数组是一个容器,既然是容器,那么容器中存放元素的空间(即在堆内存开辟出来的空间)是否可以存储使用者指定类型的元素?
// 前面看到在空间中存储基本数据类型的数据是可以的,那么是否可以存储引用数据类型的数组呢? 答:可以的
// 类比:家里的冰箱是一个容器,冰箱里可以存放若干个小的容器冰格(大容器里可以放小容器) // 二维数组的概念:元素为一维数组的(一维)数组 // 二维数组定义及初始化的形式1(动态初始化)
// 数据类型[][] 数组名 = new 数据类型[m][n];
// m:表示该二维数组有多少个一维数组
// n:表示每一个一维数组有多少个元素 int[][] yearSale = new int[4][3];
// 显示出的 [[ 表示是二维数组, 类比 显示出 [ 表示是一维数组
System.out.println(yearSale); // [[I@15db9742 System.out.println("------------------------------"); // yearSale[0]表示取得yearSale这个二维数组的第一个元素,也就是一个一维数组
System.out.println(yearSale[0]); // [I@6d06d69c
System.out.println(yearSale[1]); // [I@7852e922
System.out.println(yearSale[2]); // [I@4e25154f
System.out.println(yearSale[3]); // [I@70dea4e System.out.println("------------------------------"); // 以yearSale[0]作为一个整体来看,yearSale[0][0]表示这个整体(一个一维数组)的第1个元素
System.out.println(yearSale[0][0]); //
System.out.println(yearSale[0][1]); //
System.out.println(yearSale[0][2]); //
}
}
 package cn.temptation;

 public class Sample02 {
public static void main(String[] args) {
// 一维数组定义有两种形式
// int[] arr1 = new int[3]; // 要求使用这种写法
// int arr2[] = new int[3]; // 二维数组定义形式1(要求使用这种写法)
int[][] yearSale1 = new int[4][3];
// 二维数组定义形式2(语法可以,但是不要这样写)
int yearSale2[][] = new int[4][3];
// 二维数组定义形式3(等你面试别人的时候问别人)
int[] yearSale3[] = new int[4][3]; System.out.println(yearSale1); // [[I@15db9742
System.out.println(yearSale2); // [[I@6d06d69c
System.out.println(yearSale3); // [[I@7852e922 // 问题:请说明下面变量的类型
int[] i, j[];
// 还是那句话"把没有见过的问题向见过的问题进行转换"
// 类比 int i, j; 等价于 int i; int j;
// 所以上面的语句按此推理应该等价于 int[] i; int[] j[]; // 推理之后还是应该验证一下
// // The local variable i may not have been initialized
// System.out.println(i); // 使用eclipse自动判定一下i的类型,为一维数组
// // The local variable j may not have been initialized
// System.out.println( j); // 使用eclipse自动判定一下j的类型,为二维数组
}
}
 package cn.temptation;

 public class Sample03 {
public static void main(String[] args) {
// 需求:小店对自己的销售额按季度进行统计,2016年各个季度统计如下:(3月初开店,11月底倒闭)
// 第1季度:3月---9k
// 第2季度:4月---10k 5月---12k 6月---9k
// 第3季度:7月---10k 8月---12k 9月---9k
// 第4季度:10月---10k 11月---12k // 单纯从存储的角度看,下面这个二维数组是可以存储的(语法上OK)
// 但是会在元素数据的语义上有歧义,到底是这个月没有开张或是倒闭,还是这个月的销售额就是0
// int[][] yearSale = new int[4][3];
// 用上述语句进行数据存储时,不但需要知道二维数组中有多少个一级元素,而且还需要知道一级元素的最大长度是多少,否则会发生存储不下的问题 // 二维数组定义及初始化的形式2(动态初始化)
// 数据类型[][] 数组名 = new 数据类型[m][];
// m:表示该二维数组有多少个一维数组 int[][] yearSale = new int[4][];
// 上述语句说明了三件事:
// 1、这个变量的类型是一个二维int数组
// 2、这个二维数组的元素是一维数组类型
// 3、该二维数组的一级元素有4个一维数组组成
System.out.println(yearSale); // [[I@15db9742 System.out.println(yearSale[0]); // null
System.out.println(yearSale[1]); // null
System.out.println(yearSale[2]); // null
System.out.println(yearSale[3]); // null
// 引用数据类型的默认值为 null
// 上述语句中new int[4][]这句话,说明了在内存的堆中开辟空间做存储,只说明开辟出4个长度的空间,至于空间里放东西(存放数据)这个事情还没做
// 只知道向空间里放的东西(存放的数据)的类型是int类型的一维数组 // 使用二维数组定义及初始化的形式2(动态初始化)这种形式需要在二维数组定义及初始化后,还需要对二维数组的一级元素进行初始化
yearSale[0] = new int[1];
// 为什么非要放一个一维数组?可以放一个基本数据类型的数据不? 答:不行
// Type mismatch: cannot convert from int to int[]
// yearSale[0] = 123;
// 侧面证明了 Java语言 是 强类型语言(使用时的随意性得到约束),语法上严格的类型要求可以避免使用上的错误产生
yearSale[1] = new int[3];
yearSale[2] = new int[3];
yearSale[3] = new int[2]; System.out.println(yearSale[0]); // [I@6d06d69c
System.out.println(yearSale[1]); // [I@7852e922
System.out.println(yearSale[2]); // [I@4e25154f
System.out.println(yearSale[3]); // [I@70dea4e System.out.println(yearSale[3][0]); //
System.out.println(yearSale[3][1]); // 0
// 产生异常:java.lang.ArrayIndexOutOfBoundsException: 1
// System.out.println(yearSale[0][1]); // 如下写法可以不可以?
// 语法错误:Cannot specify an array dimension after an empty dimension 不能在一个空的维数后定义一个数组维数
// 这个语法错误可以理解为:第一个中括号中的数字表示的是这个二维数组有多少个一维数组
// 第一个中括号中没有数字也就是不知道有多少个一维数组(一级元素),在不知道的情况下就要去给每个一级元素开辟3个长度的空间,如何开辟?编译器做不到
// int[][] arr = new int[][3];
}
}
 package cn.temptation;

 public class Sample04 {
public static void main(String[] args) {
// 二维数组定义及初始化的形式3(静态初始化) // 简写形式
// 数据类型[][] 数组名 = {
// { 二维数组的元素1的元素1, 二维数组的元素1的元素2, ..., 二维数组的元素1的元素n },
// { 二维数组的元素2的元素1, 二维数组的元素2的元素2, ..., 二维数组的元素2的元素n },...
// { 二维数组的元素m的元素1, 二维数组的元素m的元素2, ..., 二维数组的元素m的元素n },
// };
// m:表示该二维数组有多少个一维数组
// n:表示每个一维数组有多少个元素
// 注意:作为这种形式的二维数组的元素(一维数组)的长度可以一致,也可以不一致 int[][] yearSale = { { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }};
System.out.println(yearSale); // [[I@15db9742 int[][] scoreArr = { { 50 }, { 10, 20, 30 }, { 60, 70 } };
System.out.println(scoreArr); // [[I@6d06d69c // 完整形式
// 数据类型[][] 数组名 = new 数据类型[][] {
// { 二维数组的元素1的元素1, 二维数组的元素1的元素2, ..., 二维数组的元素1的元素n },
// { 二维数组的元素2的元素1, 二维数组的元素2的元素2, ..., 二维数组的元素2的元素n },...
// { 二维数组的元素m的元素1, 二维数组的元素m的元素2, ..., 二维数组的元素m的元素n },
// };
// m:表示该二维数组有多少个一维数组
// n:表示每个一维数组有多少个元素
// 注意:作为这种形式的二维数组的元素(一维数组)的长度可以一致,也可以不一致 int[][] yearSaleEx = new int[][] { { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }};
System.out.println(yearSaleEx); // [[I@7852e922 int[][] scoreArrEx = { { 50 }, { 10, 20, 30 }, { 60, 70 } };
System.out.println(scoreArrEx); // [[I@4e25154f System.out.println(scoreArr[0]); // [I@70dea4e
System.out.println(scoreArr[1]); // [I@5c647e05
System.out.println(scoreArr[2]); // [I@33909752 System.out.println(scoreArr[0][0]); //
}
}
 package cn.temptation;

 public class Sample05 {
public static void main(String[] args) {
// 二维数组的遍历
int[][] yearSale = { { 10, 20, 30 }, { 40, 50, 60 }, { 70, 80, 90 }, { 77, 88, 99 } }; // 类比一维数组的遍历
// 这里二维数组的length属性表示二维数组包含的元素(一维数组)的个数
System.out.println(yearSale.length); // 4 // 最简单的思路
// for (int i = 0; i < yearSale[0].length; i++) {
// System.out.println(yearSale[0][i]);
// }
// for (int i = 0; i < yearSale[1].length; i++) {
// System.out.println(yearSale[1][i]);
// }
// for (int i = 0; i < yearSale[2].length; i++) {
// System.out.println(yearSale[2][i]);
// }
// for (int i = 0; i < yearSale[3].length; i++) {
// System.out.println(yearSale[3][i]);
// } // 因为又发现重复的执行,考虑使用循环
// for (int i = 0; i < yearSale.length; i++) {
// for (int j = 0; j < yearSale[i].length; j++) {
// System.out.println(yearSale[i][j]);
// }
// } // 调用方法
printArray(yearSale);
} // 需求:制作一个二维数组的打印方法printArray,显示例如:[[10, 20, 30], [40, 50, 60], [70, 80, 90], [77, 88, 99]]
// 写法1、在一个方法中打印显示
/**
* 二维数组打印方法
* @param yearSale:二维数组
*/
// public static void printArray(int[][] arr) {
// System.out.print("[");
//
// // 遍历二维数组
// for (int i = 0; i < arr.length; i++) {
// if (i == arr.length - 1) { // 二维数组的最后一个元素 加上"]"
// // 遍历一维数组
// System.out.print("[");
//
// for (int j = 0; j < arr[i].length; j++) {
// if (j == arr[i].length - 1) { // 一维数组的最后一个元素 加上"]"
// System.out.print(arr[i][j] + "]");
// } else { // 一维数组的其他元素 加上","
// System.out.print(arr[i][j] + ",");
// }
// }
//
// // 二维数组的最后一个元素 加上"]"
// System.out.print("]");
// } else { // 二维数组的其他元素 加上","
// // 遍历一维数组
// System.out.print("[");
//
// for (int j = 0; j < arr[i].length; j++) {
// if (j == arr[i].length - 1) { // 一维数组的最后一个元素 加上"]"
// System.out.print(arr[i][j] + "]");
// } else { // 一维数组的其他元素 加上","
// System.out.print(arr[i][j] + ",");
// }
// }
//
// // 二维数组的其他元素 加上","
// System.out.print(",");
// }
// }
//
// // 换行
// System.out.println();
// } // 写法2、不同的事情在不同的方法中做
/**
* 二维数组的打印方法
* @param arr:二维数组
*/
public static void printArray(int[][] arr) {
System.out.print("["); // 遍历二维数组
for (int i = 0; i < arr.length; i++) {
// 1、调用一维数组的打印方法
printArray(arr[i]); // 2、打印完一维数组后,添加不同的后续内容
if (i == arr.length - 1) { // 二维数组的最后一个元素 加上"]"
System.out.print("]");
} else { // 二维数组的最后一个元素 加上","
System.out.print(",");
}
} // 换行
System.out.println();
} /**
* 一维数组的打印方法
* @param arr:一维数组
*/
public static void printArray(int[] arr) {
System.out.print("["); // 遍历数组
for (int i = 0; i < arr.length; i++) {
if (i == arr.length - 1) { // 一维数组的最后一个元素 加上"]"
System.out.print(arr[i] + "]");
} else { // 一维数组的最后一个元素 加上","
System.out.print(arr[i] + ",");
}
}
}
}
 package cn.temptation;

 public class Sample06 {
public static void main(String[] args) {
// 需求:小店对自己的销售额按季度进行统计,2016年各个季度统计如下:(3月初开店,11月底倒闭)
// 第1季度:3月---4k
// 第2季度:4月---10k 5月---12k 6月---9k
// 第3季度:7月---10k 8月---19k 9月---9k
// 第4季度:10月---10k 11月---12k
// 使用二维数组计算2016年该店的销售总和、月最高销售额、月最低销售额 // int[][] saleArr = { { 4 }, { 10, 12, 9 }, { 10, 19, 9 }, { 10, 12 } }; // 下句语法正确,再次理解"二维数组就是元素为一维数组的一维数组"
int[][] saleArr = {};
// System.out.println(saleArr); // [[I@15db9742
// System.out.println(saleArr.length); // System.out.println("2016年该店的销售总和为:" + yearTotal(saleArr) + "k元"); System.out.println("2016年该店的月最高销售额为:" + monthMaxSale(saleArr) + "k元"); System.out.println("2016年该店的月最低销售额为:" + monthMinSale(saleArr) + "k元");
} /**
* 计算年销售总和
* @param arr:二维数组
* @return:年销售总和
*/
public static int yearTotal(int[][] arr) {
int total = 0; for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
total += arr[i][j];
}
} return total;
} /**
* 统计月最高销售额
* @param arr:二维数组
* @return:月最高销售额
*/
public static int monthMaxSale(int[][] arr) {
int max = 0; for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
max = (max > arr[i][j]) ? max : arr[i][j];
}
} return max;
} /**
* 统计月最低销售额
* @param arr:二维数组
* @return:月最低销售额
*/
public static int monthMinSale(int[][] arr) {
// 如下写法逻辑错误,如果没有比0小的销售额,最小值就一直为0
// int min = 0; // 如下写法对于没有销售额的二维数组来说,执行时会产生异常
// 产生异常:java.lang.ArrayIndexOutOfBoundsException: 0
// 考虑设置二维数组的第一个二级元素为比较的标杆
// int min = arr[0][0]; // 如果没有销售额时,如何处理?
int min = (arr.length == 0) ? 0 : arr[0][0]; for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
min = (min < arr[i][j]) ? min : arr[i][j];
}
} return min;
}
}
 package cn.temptation;

 import java.util.Scanner;

 public class Sample07 {
public static void main(String[] args) {
// 需求:编写程序,输出如下图形(杨辉三角)
// 1
// 1 1
// 1 2 1
// 1 3 3 1
// 1 4 6 4 1
// 1 5 10 10 5 1 // 思路:(找规律)
// 1、第n行有n个数(n从1开始)
// 2、第1行和第2行均为1,从第3行开始,每行的首尾均为1
// 3、从第3行的第2列开始到该行的倒数第二个数结束,该位置上的数等于上一行同列的数 + 上一行前一列的数
// 从第4行的第2列开始到该行的倒数第二个数结束,该位置上的数等于上一行同列的数 + 上一行前一列的数
// ......以此类推 System.out.println("键盘录入杨辉三角的行数:");
Scanner input = new Scanner(System.in);
int row = input.nextInt();
input.close(); // 考虑存储杨辉三角中的数进行计算,都是数字(具有相同意义),考虑使用数组;
// 因为涉及到行列,考虑使用二维数组;
// 因为行中的列数不同,所以声明及初始化数组时使用只有一级元素长度没有二级元素长度的定义方式
int[][] arr = new int[row][]; // 根据规律1
// arr[0] = new int[1];
// arr[1] = new int[2];
// arr[2] = new int[3];
// ...
// arr[n] = new int[n+1]; for (int i = 0; i < row; i++) {
// 二维数组中的每个一级元素依据规律1创建相应长度的一维数组
arr[i] = new int[i + 1]; // 依据规律2:第1行和第2行均为1,从第3行开始,每行的首尾均为1
arr[i][0] = 1;
arr[i][i] = 1;
} // 依据规律3:从第3行的第2列开始到该行的倒数第二个数结束,该位置上的数等于上一行同列的数 + 上一行前一列的数
// 从第4行的第2列开始到该行的倒数第二个数结束,该位置上的数等于上一行同列的数 + 上一行前一列的数
// ......以此类推
for (int i = 2; i < arr.length; i++) { // 外层循环的i表示行
for (int j = 1; j < arr[i].length - 1; j++) { // 内层循环的j表示列
arr[i][j] = arr[i - 1][j] + arr[i - 1][j - 1];
}
} // 调用方法打印数组
printArray(arr);
} /**
* 打印数组
* @param arr:二维数组
*/
public static void printArray(int[][] arr) {
// 遍历数组
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
System.out.print(arr[i][j] + "\t");
} // 换行
System.out.println();
}
}
}
 package cn.temptation;

 import java.util.Scanner;

 public class Sample08 {
public static void main(String[] args) {
// 需求:制作一个成绩查询系统
// 提供的数据有:
// 1、给定学生的学号(1001, 1002, 1003)
// 2、给定学生的三门功课的成绩(语文、数学、英语)
// 要求:
// 1、输入某个同学的学号,显示出该同学的三门功课的成绩
// 2、输入某一门功课的编号(0---语文,1---数学,2---英语),显示该门功课成绩不及格的同学的学号,以及有多少个同学不及格 // 关键点:学生的学号 和 其各门功课成绩如何对应起来? 考虑让学号数组的索引 和 成绩数组的一级元素的索引同步
int[] studentArr = { 1001, 1002, 1003 };
int[][] scoreArr = { { 10, 20, 30 }, { 40, 50, 60 }, { 70, 80, 90 } };
// 课程数组的索引 和 成绩数组的二级元素的索引同步
String[] courseArr = { "语文", "数学", "英语" }; // 如下写法把学号和成绩糅合在一起存储也可以,但是不建议这样存储,因为我们说过数组是存储同一类型数据的容器
// 这里说的同一类型不仅指的是同一种数据类型,也指的是有相同的语义类型的数据
// int[][] arr = { { 1001, 10, 20, 30 }, { 1002, 40, 50, 60 }, { 1003, 70, 80, 90 } }; Scanner input = new Scanner(System.in);
System.out.println("输入学生的学号:");
int number = input.nextInt();
// 调用方法
getScoreByNumber(courseArr, studentArr, scoreArr, number); // 换行
System.out.println(); System.out.println("输入某一门功课的编号(0---语文,1---数学,2---英语)");
int course = input.nextInt();
// 调用方法
getNGInfo(courseArr, studentArr, scoreArr, course); input.close();
} /**
* 根据学号获取该生的各门功课成绩
* @param courseArr: 课程名称数组
* @param studentArr: 学生学号数组
* @param scoreArr: 学生成绩数组
* @param number: 查询时录入的学生学号
*/
public static void getScoreByNumber(String[] courseArr, int[] studentArr, int[][] scoreArr, int number) {
for (int i = 0; i < studentArr.length; i++) {
if (number == studentArr[i]) { // 根据录入的学生学号在数组中找到对应的该学生的学号
// 因为学号数组的索引 和 成绩数组的一级元素的索引同步,所以在 成绩数组的一级元素对应的一维数组中查找该生的各门功课的成绩
for (int j = 0; j < scoreArr[i].length; j++) {
if (j == scoreArr[i].length - 1) {
System.out.print(courseArr[j] + ":" + scoreArr[i][j]);
} else {
System.out.print(courseArr[j] + ":" + scoreArr[i][j] + ",");
}
}
}
}
} /**
* 显示该门功课成绩不及格的同学的学号,以及有多少个同学不及格
* @param courseArr: 课程名称数组
* @param studentArr: 学生学号数组
* @param scoreArr: 学生成绩数组
* @param course: 录入的课程名称索引
*/
public static void getNGInfo(String[] courseArr, int[] studentArr, int[][] scoreArr, int course) {
int total = 0; System.out.println("【" + courseArr[course] + "】未及格学生的学号列表:");
for (int i = 0; i < studentArr.length; i++) {
if (scoreArr[i][course] < 60) {
total++;
System.out.print(studentArr[i] + "\t");
}
} // 换行
System.out.println(); System.out.println("【" + courseArr[course] + "】未及格学生的人数为:" + total);
}
}

【原】Java学习笔记012 - 数组的更多相关文章

  1. 【原】Java学习笔记011 - 数组

    package cn.temptation; import java.util.Scanner; public class Sample01 { public static void main(Str ...

  2. 【原】Java学习笔记010 - 数组

    package cn.temptation; public class Sample01 { public static void main(String[] args) { // 需求:一堆分数,要 ...

  3. Java学习笔记七——数组工具类Arrays

    数组工具类Arrays Java提供的Arrays类里包含的一些static修饰的方法可以直接操作数组.若将里面的方法用熟的话,那开发效率会大大提高.下面介绍其中的方法. List<T> ...

  4. java学习笔记六——数组

    数组类型 数组是一种常见的数据结构,可用于存放多个数据,每一个数组元素存放一个数据,通常可以通过下标进行访问其元素. Java数组要求所有数组元素具有相同的数据类型.因此,数组元素的数据类型是唯一的. ...

  5. Java学习笔记day04_数组

    1.switch case switch语句中表达式的数据类型是有要求的: JDK 1.0 ~ 1.4 , 数据类型接受byte, short, int, char JDK 1.5 , 数据类型接受b ...

  6. 1.14(java学习笔记)数组

    假如我们需要用到1000个相同类型的数据,肯定不可能创建1000个变量, 这样既不方便,也不直观,也不便于我们使用.这时就需要用到数组. 一.数组的声明与使用 public class Array { ...

  7. Java学习笔记 03 数组

    一.数组的创建和使用 数组的创建和使用 >>创建方法1:先声明,再用new关键字分配内存(使用new关键字分配内存,整形数组中各个元素的初始值都为0) String str[]; str= ...

  8. Java学习笔记之——数组

    一.一维数组 1. 什么是数组 变量:在内存中开辟了一块空间 数组:在内存中开辟了一块连续的空间,每块空间保存的值/对象叫做元素,每个元素都有对应的下标.(下标从0开始) 2. 初始化一个数组 1)不 ...

  9. java学习笔记之数组

随机推荐

  1. eclipse菜单栏不显示 + the system is running in lou-graphics mode问题

    作为一个Linux使用新手,一条指令执行下去,就可能是一堆的错误.这不,笔者在Ubuntu16.04上安装eclipse后没有菜单栏,用起来不是很方便,网上找一篇老师写的博客ubuntu 中 ecli ...

  2. SpringBoot环境搭建

    创建 maven 项目 , 选择的打包类型为 jar 类型 自己构建 SpringBoot 项目时 , 要继承 SpringBoot 的父项目 , 这里用的版本是 2.1.4 点击 Finish , ...

  3. SpringMVC接收json数组对象

    最近帮一个妹子解决一个需求,就是前台使用ajax传三个相同的对象,再加一个form表单对象.然后遇到各种问题,终于解决了,@RequestBody接收Json对象字符串 ​以前,一直以为在Spring ...

  4. spark能传递外部命名参数给main函数吗?

    查了资料好像都没有办法.只能通过: def main(args: Array[String]): Unit = { // 读取参数 var city = args(0) var input = arg ...

  5. 获取model的自定义特性

    class Program { static void Main(String[] args) { var t = typeof(A); var pName = t.GetProperty(" ...

  6. qt 拖拽 修改大小(二)

    最近项目需要实现windows下橡皮筋的效果,所以对此做了一些了解,特此记录. 首先windows系统是支持橡皮筋效果的,需要使用win32方 法:SystemParametersInfo(SPI_S ...

  7. asp.net core系列 39 Web 应用Razor 介绍与详细示例

    一. Razor介绍 在使用ASP.NET Core Web开发时, ASP.NET Core MVC 提供了一个新特性Razor. 这样开发Web包括了MVC框架和Razor框架.对于Razor来说 ...

  8. redis 系列8 数据结构之整数集合

    一.概述 整数集合(intset)是集合键的底层实现之一, 当一个集合只包含整数值元素,并且这个集合元素数量不多时, Redis就会使用整数集合作为集合键的底层实现.下面创建一个只包含5个元素的集合键 ...

  9. SpringBoot+gradle项目构建war

    前言 一开始觉得这并不是什么很难的事情,但是踩坑了之后才发现... 步骤 1.在build.gradle配置文件中加入apply plugin: 'war' 很多人以为这样就完事了,我一开始也是这样认 ...

  10. ubuntu 15.10 设置静态ip 分配固定ip 设置dns 设置网关 命令行配置ip 固定ip不生效怎么办

    要用到的文件: 配置接口信息 /etc/network/interfaces 配置内容: auto eth0 iface eth0 inet static address 192.168.216.18 ...