Ai
1 Star 0 Fork 59

Yangjianwei/java-performance

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
VTableTest.java 544 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiandafu 提交于 2019-11-13 10:35 +08:00 . sample
package com.ibeetl.code.jit;
/**
* 虚方法调用观察,可以使用{@code HellWorld} 例子的虚拟机参数
* @author 公众号 java系统优化
*/
public class VTableTest {
public static void main(String[] args) throws Exception{
Foo foo = getFoo();
int total = 0;
for(int i=0;i<10000;i++){
total+=foo.say();
}
}
public static Foo getFoo(){
return new Bar();
}
}
class Foo {
int say() {
return 1;
}
}
class Bar extends Foo{
int say(){
return 2;
}
void bar() {
System.out.println("bar");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/higher/java-performance.git
git@gitee.com:higher/java-performance.git
higher
java-performance
java-performance
master

搜索帮助