農農  

2020年3月11日

摘要: 代码优化 1、尽可能使用局部变量 调用方法时传递的参数以及在调用中创建的临时变量都保存在栈中速度较快,其他变量,如 静态变量、实例变量等,都在堆中创建,速度较慢。另外,栈中创建的变量,随 着方法的运行结束,这些内容就没了,不需要额外的垃圾回收。 2、尽量减少对变量的重复计算 明确一个概念,对方法的调 阅读全文
posted @ 2020-03-11 16:29 Baekhyunne 阅读(183) 评论(0) 推荐(0) 编辑
 
摘要: 1.通过javap命令查看class文件的字节码内容 1.1 编写一个简单的Test类: public static void main(String[] args) { int a = 2; int b = 5; int c = b ‐ a; System.out.println(c); } 1. 阅读全文
posted @ 2020-03-11 16:08 Baekhyunne 阅读(161) 评论(0) 推荐(0) 编辑