Skip to content

Commit 71254fa

Browse files
committed
add float&double test
1 parent 4cb9a1f commit 71254fa

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎src/main/java/com/tencent/aop/aop.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
# 代码参考:https://blog.csdn.net/feigeswjtu/article/details/78741245
2+
13
参考:https://blog.csdn.net/javazejian/article/details/56267036#%E5%9F%BA%E4%BA%8Easpect-spring-aop-%E5%BC%80%E5%8F%91
24
* aop是一种编程范式,面向切面编程.比如鉴权/打印日志等等场景.
35
* 什么是aop:https://www.zhihu.com/question/24863332
46
* spring aop基于动态代理:jdk proxy和Cglib. 在使用时机上进行动态调整,当有接口时,使用jdk proxy,否则使用 cglib.
57
* jdk proxy:被代理类必须实现接口.
8+
* cglib proxy:使用了继承代理.
69
* 动态代理的底层是通过反射来实现的,通过反射拿到被代理类和它的实现类,然后生成代理类,去执行我们的切面逻辑.
710
* Filter和Inteceptor是责任链模式,spring aop是代理模式.
811

12+
* aspectj采用的是编译的时候生成代理类,需要专门的织入工具; spring aop是使用的动态织入. 静态织入效率会更高,不用运行的时候,每次去织入.
13+
914

1015
# aop中的关键概念
1116
* aspect:切面,具体的需要切入的逻辑;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.tencent.javabase;
2+
3+
/**
4+
*
5+
* https://blog.csdn.net/boatalways/article/details/17121205
6+
* Created by walker on 2019/7/20.
7+
*/
8+
public class FloatTest {
9+
public static void main(String[] args) {
10+
testFloat();
11+
}
12+
13+
private static void testFloat() {
14+
System.out.println(0.99999999f == 1);
15+
16+
float a= 0.8f;
17+
float b= 0.1f;
18+
float c = a+b;
19+
System.out.println(a);
20+
System.out.println(b);
21+
System.out.println(c);
22+
23+
24+
System.out.println(0.4*0.2);
25+
26+
System.out.println(40000000.0f == 40000000.5f); // float类型字面量
27+
}
28+
}

0 commit comments

Comments
 (0)