随笔分类 -  JAVA / java基础

数组拷贝System.arraycopy
摘要:数组拷贝 第一种方式: package com.coding.demo.concurrent; import java.util.Arrays; /** * 使用Arrays.copyOf() */ public class TestArraysCopyOf { public static void 阅读全文

posted @ 2024-08-13 18:45 ~码铃薯~ 阅读(12) 评论(0) 推荐(0) 编辑

hashCode方法 和 equals()方法
摘要:package com.coding.spring.mvc; import java.util.HashSet; public class User { private String name; public User(String name) { this.name = name; } @Over 阅读全文

posted @ 2024-08-01 09:55 ~码铃薯~ 阅读(6) 评论(0) 推荐(0) 编辑

Integer的比较
摘要:public static void main(String[] args) { Integer i1 = 127; Integer i2 = Integer.valueOf(127); // integercache Integer i3 = new Integer(127); System.ou 阅读全文

posted @ 2024-07-31 14:53 ~码铃薯~ 阅读(9) 评论(0) 推荐(0) 编辑

map集合
摘要:package com.coding; import java.util.*; public class Test { public static void main(String[] args) { // Map<String,String> map = new HashMap<>(); // m 阅读全文

posted @ 2024-07-15 17:08 ~码铃薯~ 阅读(4) 评论(0) 推荐(0) 编辑

public java.net.URL getResource(String name)获取到的路径乱码
摘要:解决办法: String absolutePath = StaticResourceUtil.class.getResource("/").getPath();absolutePath = URLDecoder.decode(absolutePath, "utf-8");进行解码就可以了。 阅读全文

posted @ 2024-05-31 14:34 ~码铃薯~ 阅读(4) 评论(0) 推荐(0) 编辑

Compilation failure 不再支持源选项 5。请使用 6 或更高版本。
摘要:添加: <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> <java.ver 阅读全文

posted @ 2024-05-15 13:45 ~码铃薯~ 阅读(16) 评论(0) 推荐(0) 编辑

二进制转十进制
摘要:public class Test09 { public static void main(String[] args) { //0b 表示二进制 System.out.println(0b11111111111111111111111111111111); // 运行结果: -1 } } 阅读全文

posted @ 2024-02-04 20:56 ~码铃薯~ 阅读(4) 评论(0) 推荐(0) 编辑

原码、反码、补码、移码
摘要:原码、反码、补码、移码 背景:为了解决计算机中减法计算的问题,因为计算机中只有加法器,减法的计算是要转换成加法才能进行。 原码 二进制首位为标志位 正数 标志位为0 0 x x x x x x x 负数 标志位为1 1 x x x x x x x 示例: 14 = 00001110 -21 = 10 阅读全文

posted @ 2024-02-03 17:42 ~码铃薯~ 阅读(2556) 评论(0) 推荐(0) 编辑

计算机中的基本运算
摘要:二进制的算术运算 1.二进制的加法运算 示例: 0+0=0 0+1=1 1+0=1 1+1=10 1011+1001=10100 2,二进制的减法运算 示例: 1-1=0 1-0=1 0-0=0 0-1=1(解释一下这个,可以看作是向前借 1,看作 2-1) 1101-1010=0011(当然前面的 阅读全文

posted @ 2024-02-03 10:03 ~码铃薯~ 阅读(386) 评论(0) 推荐(0) 编辑

Function接口
摘要:java中提供的Function接口,public interface Function<T, R> { 主要的作用,是将一个输入转换成另一个输出。 阅读全文

posted @ 2023-10-21 15:28 ~码铃薯~ 阅读(8) 评论(0) 推荐(0) 编辑

数字字符串格式化,位数不足前面补0
摘要:我是这样写的:BigDecimal b1 = new BigDecimal("0.01");BigDecimal result = b1.multiply(new BigDecimal("1000")).setScale(0, RoundingMode.DOWN);System.out.printl 阅读全文

posted @ 2023-09-25 20:12 ~码铃薯~ 阅读(260) 评论(0) 推荐(0) 编辑

Map浅拷贝与深拷贝
摘要:参考网址:https://blog.csdn.net/yydqmyhdnl/article/details/51094556?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault% 阅读全文

posted @ 2023-07-03 21:34 ~码铃薯~ 阅读(61) 评论(0) 推荐(0) 编辑

java算数左移和右移
摘要:public class Test13 { public static void main(String[] args) { System.out.println(64<<2); // 左移:乘以2 256 System.out.println(64>>2); // 右移:除以2 16 }} 阅读全文

posted @ 2022-12-23 21:57 ~码铃薯~ 阅读(50) 评论(0) 推荐(0) 编辑

for循环外定义对象(变量)和for循环里定义对象(变量)的区别
摘要:外边: package com.sky.demo; import java.util.ArrayList; public class Test { public static void main(String[] args) { User user = new User(); ArrayList<U 阅读全文

posted @ 2022-08-05 10:55 ~码铃薯~ 阅读(553) 评论(0) 推荐(0) 编辑

AtomicLong类
摘要:AtomicLong类在高并发的场景下使用比较多,下面列举一下这个类中经常使用到的方法: AtomicLong aLong = new AtomicLong(1); System.out.println(aLong.get()); System.out.println(aLong); // 初始化一 阅读全文

posted @ 2022-06-18 19:15 ~码铃薯~ 阅读(79) 评论(0) 推荐(0) 编辑

真实项目中Switch语句的高级写法
摘要:普通: public class Test { public static void main(String[] args) { String bussType = "01"; String bussinessType = "0000000"; Test test = new Test(); Sys 阅读全文

posted @ 2022-03-10 10:10 ~码铃薯~ 阅读(111) 评论(0) 推荐(0) 编辑

String.length()和String.getBytes().length的用法讲解
摘要:参考网址:https://blog.csdn.net/weixin_39309402/article/details/98127000 阅读全文

posted @ 2022-02-21 09:41 ~码铃薯~ 阅读(70) 评论(0) 推荐(0) 编辑

wget 和 curl命令
摘要:这两个命令在生产环境中使用的比较多 使用方法:wget 地址 //主要用来验证网络通不通,这里,请求方式使用的是GET方式 使用方法:curl 地址 //主要用来请求网页中的html信息,既可以用于GET请求方式又可以用于POST请求方式。 投产的时候会使用到的命令: curl -u 141234@ 阅读全文

posted @ 2022-01-21 10:59 ~码铃薯~ 阅读(89) 评论(0) 推荐(0) 编辑

内部接口
摘要:内部接口 今天 看源码的时候,发现有的类中的接口内部还有嵌套的接口,于是百度了一下,进行了详细的了解。 定义:内部接口,说白了就是一个普通接口的内部还嵌套这接口。 接口中嵌套接口 接下来我们看这个小案例: //内部接口的使用 public interface IMessage { public vo 阅读全文

posted @ 2022-01-18 10:53 ~码铃薯~ 阅读(566) 评论(0) 推荐(0) 编辑

使用idea创建web项目
摘要:参考视频:https://www.bilibili.com/video/av498832157 阅读全文

posted @ 2022-01-02 16:07 ~码铃薯~ 阅读(35) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示