diff --git a/css/css3.md b/css/css3.md new file mode 100644 index 0000000000000000000000000000000000000000..be7d9211310c2fc2fc0feb8703bbdb2b1a301b5c --- /dev/null +++ b/css/css3.md @@ -0,0 +1,2 @@ +## 盒子 +1. box-sizing: border-box; //margin和padding不会撑大盒子了 \ No newline at end of file diff --git "a/css/css\345\237\272\347\241\200\347\237\245\350\257\206.md" "b/css/css\345\237\272\347\241\200\347\237\245\350\257\206.md" index b1cefbbc7c2126341e506cc32bdb1ed12e8cebcb..95ff22d93e31189cd4ae6e5ee9fdcde5ab33bfa9 100644 --- "a/css/css\345\237\272\347\241\200\347\237\245\350\257\206.md" +++ "b/css/css\345\237\272\347\241\200\347\237\245\350\257\206.md" @@ -3,4 +3,8 @@ ## [position](./position.md) ## float ## 盒子 -## 字体 +## [字体](./字体.md) +## 精灵图 +## 字体图标 +## css3 +## [案例](./案例.md)n \ No newline at end of file diff --git a/css/position.md b/css/position.md index 34d76f64180c08c6832925b61ebd233d6e1a5c8d..1895fcca894563134f4c6dbd2fb161a7ec1a3f8c 100644 --- a/css/position.md +++ b/css/position.md @@ -1,3 +1,11 @@ +#### 块元素 +### 元素分类 +| 分类 | 列举 | 宽 | 高 | 行高 | margin | padding | border | 占行 | +|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| +|行内元素|| 无宽 | 无高 | 有行高,但优先使用父块元素的行高 | 有margin-left margin-right,没有margin-top margin-bottom | padding的上下左右都有 | 有 | 共享一行 | +|块元素 || 宽 | 高 | 有行高 | margin的上下左右都有 | padding的上下左右都有 | 有 | 独占一行 | +|行内块元素 | img input td | 宽 | 高 | 无行高 | margin的上下左右都有 | padding的上下左右都有 | 有 | 共享一行 | + #### position |值| 作用 | 文档流 | 使用场景 | |:-:|:-:|:-:|:-:| @@ -49,6 +57,7 @@ ```` + 1. 作用:固定盒子的位置 static relative absolute fixed 2. 边偏移: top bottom right left 3. > relative 相对于自身进行定位 ---------- 原来的位置仍然在,不脱离文档流 diff --git "a/css/\345\255\227\344\275\223.md" "b/css/\345\255\227\344\275\223.md" new file mode 100644 index 0000000000000000000000000000000000000000..8214805fb6681bc96cc292a62adcbe2919a7e052 --- /dev/null +++ "b/css/\345\255\227\344\275\223.md" @@ -0,0 +1,47 @@ +## 字体 +### 综合写法 +```` +/* 复合属性: 简写的方式 节约代码 */ +/* font: font-style font-weight font-size/line-height font-family; */ +/* font: italic 700 16px 'Microsoft yahei'; */ +font: 20px '黑体'; +```` +### 颜色 +```` +color :"" +```` + +### 对齐 +```` + text-align: right; + line_height: 盒子高度 +```` + +### 文本装饰 +```` +/* 下划线 */ +text-decoration: underline; +/* 删除线 */ +text-decoration: line-through; +/* 上划线 */ +text-decoration: overline; +/* 取消a默认的下划线 */ +text-decoration: none; +```` + +### 首行缩进 +```` +/* 如果此时写了2em 则是缩进当前元素 2个文字大小的距离 */ +text-indent: 2em; +```` + +### 背景 +```` + /* background-image: url(images/bg.jpg); +background-repeat: no-repeat; +background-position: center top; */ +/* 把背景图片固定住 */ +/* background-attachment: fixed; +background-color: black; */ +background: black url(images/bg.jpg) no-repeat fixed center top; +```` \ No newline at end of file diff --git "a/css/\346\241\210\344\276\213.md" "b/css/\346\241\210\344\276\213.md" new file mode 100644 index 0000000000000000000000000000000000000000..91439549eae7fd3ac1228b9d088e4029dcc468d7 --- /dev/null +++ "b/css/\346\241\210\344\276\213.md" @@ -0,0 +1,8 @@ +1. css三角形 +```` +```` +2. 精灵图 + +3. 字体图标 + +4. \ No newline at end of file diff --git "a/css/\347\247\273\345\212\250\347\253\257.md" "b/css/\347\247\273\345\212\250\347\253\257.md" new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ "b/css/\347\247\273\345\212\250\347\253\257.md" @@ -0,0 +1 @@ + diff --git a/java_note/Java.md b/java_note/Java.md index f2c0f37d8c98d30a455ea120482e515a4fa9d69b..4529428e956660a00f5ab645853d85b95054abfb 100644 --- a/java_note/Java.md +++ b/java_note/Java.md @@ -1,3 +1,467 @@ +# Java + +## 1. java基础 + +### 1.1 数据类型 + +#### 1.1.1 基本数据类型 + ```tex + 1. boolean + 2. char + 3. byte 、short、int、long + 4. float 、 double + ``` + +### 1.2 String类型 + +​ [点击跳转深入String](#深入String) + +### 1.3 数组 + +1. 定义 + + > 数组是一种 【存储同一数据类型】【在内存上连续排列】的 数据结构,访问很快 + +2. 声明 创建 使用 + + ````java + int[] num; + + num = new int[3]; + + num[数组key值]; + ```` + +3. 匿名数组 + + ````java + new int[3]{1,2,3} + ```` + +4. 多维数组 + + ````java + int[][] num; + ```` + +## 2. 深入String + +### 2.1 ==和equals + +> ==比较的是堆内存中的地址 +> +> equals比较的是常量池中,字符串内容是否一样 + +### 2.2 String方法 + +#### 2.2.1 compareTo + +````java +public static void main(String[] args) { + String str1 = "abc"; + String str2 = "abA"; + System.out.println(str1.compareTo(str2)); //返回字符串ASCLL码的差值 34 +} +```` + +#### 2.2.2 字符串拼接 + + +#### 2.2.4 其他 + +1. length() + +2. indexOf() 、 lastIndexOf() + + ````java + str.IndexOf(String char); // 返回这个字母的位数,从0开始,不存在返回-1 + str.IndexOf(String char,Int fromIndex); // 返回这个字母的位数,从0开始 + ```` + +3. startWith() 、 endWith() + + > 判断字符串的开始和结束 boolean + +4. charAt + + > 获取指定索引的位置的字符 + +5. substring + + > public String substring(Int beginIndex) + > + > public String substring(Int beginIndex, endIndex) + +6. split + + > public String[] split(String regex) + +7. replace + + > public String replace(String oldString, String newString) + > + > replaceFirst() + > + > replaceAll() + +8. repeat + + > public String repeat(Int count) + +9. toLowerCase() + +10. toUpperCase() + +### 2.3 buffer and builder + +- 和String类不同的是,StringBuffer 和 StringBuilder 类的对象能够被多次的修改,并且不产生新的未使用对象。 + +#### 2.3.1 StringBuffer + +1. 线程安全 + +2. 举例 + + ````java + /** + * + * 序号 方法描述 + * 1 public StringBuffer append(String s) + * 将指定的字符串追加到此字符序列。 + * 2 public StringBuffer reverse() + * 将此字符序列用其反转形式取代。 + * 3 public delete(int start, int end) + * 移除此序列的子字符串中的字符。 + * 4 public insert(int offset, int i) + * 将 int 参数的字符串表示形式插入此序列中。 + * 5 replace(int start, int end, String str) + * 使用给定 String 中的字符替换此序列的子字符串中的字符。 + **/ + public class Test{ + + public static void main(String args[]){ + StringBuffer sBuffer = new StringBuffer(" test"); + sBuffer.append(" String Buffer"); + System.out.println(sBuffer); // test String Buffer + } + } + + ```` + + + +#### 2.3.2 StringBuilder + + 1. 线程不安全 + 2. + +## 3. 集合 + +### 3.1 集合接口和实现类 + +#### 3.1.1 集合框架的基本结构 +1. Collection实现了List,Set,Queue三大类 +2. ![集合接口和实现类结构](https://www.runoob.com/wp-content/uploads/2014/01/2243690-9cd9c896e0d512ed.gif) + + + +#### 3.1.2 迭代 + +1. Iterator + + ````java + /** + * Iterator iterator = lst.iterator(); + * iterator.hasNext() + * iterator.next() + + **/ + public static void main(String[] args) { + List lst = new ArrayList(); + lst.add("aaa"); + lst.add("bbb"); + lst.add("ccc"); + lst.add("ddd"); + lst.add("eee"); + lst.add("fff"); + Iterator iterator = lst.iterator(); + //iterator.hasNext()如果存在元素的话返回true + while(iterator.hasNext()) { + //iterator.next()返回迭代的下一个元素 + System.out.println(iterator.next()); + } + } + ```` + +2. for each + + ````java + public static void main(String[] args) { + List num = new ArrayList(); + num.add(1); + num.add(9); + num.add(5); + for (Integer i: num){ + System.out.println(i); + } + } + ```` + + + +3. forEach + + > 可以在实现Iterable接口的对象上调用forEach + + ````java + + ```` + +### 3.2 数据结构 + +#### 链表(Linked List) + +- [链表介绍](https://zhuanlan.zhihu.com/p/29627391) + +#### 栈(stack) + +#### 数组(ArrayList) + +定义 + +- 数组是一种 【存储同一数据类型】【在内存上连续排列】的 数据结构,访问很快 + +优点: + +- 按照索引查询元素的速度很快; +- 按照索引遍历数组也很方便。 + +缺点: + +- 数组的大小在创建后就确定了,无法扩容; +- 数组只能存储一种类型的数据; + +添加、删除元素的操作很耗时间,因为要移动其他元素。 + +#### 队列(Queue) + +#### 树(Tree) + +#### 堆 (Heap) + +#### 哈希表(Hash) + +#### 图(Graph) + + + +### 3.3 List + +#### 3.3.1 ArrayList + +- 定义 + + > 底层实现是采用数组来保存元素,单向链表 + +- 方法: + +1. 增 + + > public boolean add(E e) + > + > public boolean addAll(int index, Collection c) + +2. 删 + + > public E remove(int index) + +3. 改 + + > set + +4. 查 + + > get + > + > indexOf() + > + > lastINdexOf() + > + > subList(int fromIndex, int endIndex) + +5. 其他 + + > size() + > + > isEmpty() + > + > contains() + > + > toArray() + +#### 3.3.2 LinkedList + +- 定义 + + > 底层采用双向链表来保存元素 + +### 3.4 set + +#### 3.4.1 HashSet + +- 定义 + + > 底层通过HashMap实现,允许空元素,不保证迭代顺序 + +- + +## 4. I/O操作 + +#### 4.1 创建目录 + +1. public boolean mkdir(); +2. public boolean mkdirs(); 创建父目录和子目录 +3. File.separator 路径分隔符 +4. createNewFile() 创建文件 +5. exists(); +6. canRead() canWrite() isHidden() +7. public String[] list() 得到数组 +8. public File[] listFiles() 得到文件对象 +9. isDirextory() +10. delete() + +````java +public static void mkdirtest(){ + File mydir = new File("./src/main/java/com/ssmtest/mkdirtest"); + try { + if(!mydir.exists()){ + mydir.mkdir(); + } + }catch (Exception e){ + System.out.println("已存在"); + e.printStackTrace(); + } +} +```` + +#### 4.2 创建文件并写入 + +````java +public static void mkfiletest(){ + String str1 = "./mkdirtest/1.txt"; + File myFilePath = new File(str1); + try { + if (!myFilePath.exists()) { + myFilePath.createNewFile(); //创建文件 + } + FileWriter resultFile = new FileWriter(myFilePath); + PrintWriter myFile = new PrintWriter(resultFile); //写入 + myFile.println("锄禾日当午"); + myFile.close(); + } + catch (Exception e) { + System.out.println("新建文件操作出错"); + e.printStackTrace(); + } +} +```` + +#### 4.3 删除文件 + +````java +public static void deletedirtest(){ + String str1 = "mkdirtest"; + File myDelFile = new File(str1); + try { + myDelFile.delete(); //有子文件的不能删除 + } + catch (Exception e) { + System.out.println("删除文件操作出错"); + e.printStackTrace(); + } +} +```` + +#### 4.4 遍历目录 + +##### 4.4.1 遍历子目录, + +````java +/** + * 遍历子目录,子目录下的目录不遍历 + **/ +public static void readtest(){ + String str1 = "mkdirtest"; + File myDelFile = new File(str1); + File[] files = myDelFile.listFiles(); + System.out.println(Arrays.toString(files)); //[mkdirtest\1, mkdirtest\2] +} +```` + +#### 4.5 写入 + +````java +public static void writetest(){ + try { + String str1 = "1.txt"; + FileWriter fw = new FileWriter(str1); + fw.write("这里是输入的内容"); + fw.flush(); + fw.close(); + } catch (IOException e) { + e.printStackTrace(); + } +} +```` + +#### 4.6 逐行读取 + +````java +```` + +#### 4.7 流式I/O + +- 字节流相关的类分别集成 抽象类 InputStream OutStream +- 字节数组输入/输出流 ByteArrayInputStream ByteArrayOutStream +- 文件输入/输出流 FileInputStream FileOutStream +- 过滤流 FilterInputStream() FilterOutStream() +- + + + + + +## 5. 日期时间 + +1. 获取日期和时间戳 + + ````java + public static void datetest(){ + Date date = new Date(); + System.out.println(date); // Thu Jun 17 14:15:18 CST 2021 + SimpleDateFormat ft = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); + System.out.println(ft.format(date)); // 星期四 2021.06.17 at 02:18:47 下午 CST + + SimpleDateFormat fta = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + System.out.println(fta.format(date)); // 2021-06-17 02:21:45 + long time = System.currentTimeMillis(); + System.out.println(time); //1623912242844 毫秒时间戳 + + SimpleDateFormat sdf = new SimpleDateFormat("D"); + System.out.println(sdf.format(date)); //一年中的第几天 + } + ```` + + + +## 其他 + +### 1 线程安全 + +> 线程安全就是多线程访问时,采用了加锁机制,当一个线程访问该类的某个数据时,进行保护,其他线程不能进行访问直到该线程读取完,其他线程才可使用。不会出现数据不一致或者数据污染。线程不安全就是不提供数据访问保护,有可能出现多个线程先后更改数据造成所得到的数据是脏数据 + +问: + +什么情况下多线程 # Java ## 1. java基础