首页 > 其他 > 详细

【JVM系列】:(一)虚拟机内存结构

时间:2017-09-27 12:48:24      阅读:302      评论:0      收藏:0      [点我收藏+]
技术分享
 1 package com.bjsxt.proxy.dymanic;
 2 
 3 import java.lang.reflect.Proxy;
 4 
 5 /** 
 6  * 动态代理测试
 7  * @author  zht 
 8  * @date 2017年9月26日 下午12:27:02 
 9  * @version 1.0   
10  * @since  
11  * @return  
12  */
13 public class Client {
14 
15     public static void main(String[] args) throws Exception {
16 
17         Iopreation io = new Operation1Impl();
18         
19         Class<?>[] interfaces = io.getClass().getInterfaces();
20         
21         Iopreation newProxyInstance = (Iopreation)Proxy.newProxyInstance(Iopreation.class.getClassLoader(), io.getClass().getInterfaces(), new LogInvocationHandler(io));
22         
23         System.out.println(newProxyInstance.getClass().getName());
24          
25         newProxyInstance.drive("奔驰");
26         newProxyInstance.sayHello();
27     }
28 
29 }
Vi
 1 package com.bjsxt.proxy.dymanic;
 2 
 3 import java.lang.reflect.Proxy;
 4 
 5 /** 
 6  * 动态代理测试
 7  * @author  zht 
 8  * @date 2017年9月26日 下午12:27:02 
 9  * @version 1.0   
10  * @since  
11  * @return  
12  */
13 public class Client {
14 
15     public static void main(String[] args) throws Exception {
16 
17         Iopreation io = new Operation1Impl();
18         
19         Class<?>[] interfaces = io.getClass().getInterfaces();
20         
21         Iopreation newProxyInstance = (Iopreation)Proxy.newProxyInstance(Iopreation.class.getClassLoader(), io.getClass().getInterfaces(), new LogInvocationHandler(io));
22         
23         System.out.println(newProxyInstance.getClass().getName());
24          
25         newProxyInstance.drive("奔驰");
26         newProxyInstance.sayHello();
27     }
28 
29 }

 

ew Code
 1 package com.bjsxt.proxy.dymanic;
 2 
 3 import java.lang.reflect.Proxy;
 4 
 5 /** 
 6  * 动态代理测试
 7  * @author  zht 
 8  * @date 2017年9月26日 下午12:27:02 
 9  * @version 1.0   
10  * @since  
11  * @return  
12  */
13 public class Client {
14 
15     public static void main(String[] args) throws Exception {
16 
17         Iopreation io = new Operation1Impl();
18         
19         Class<?>[] interfaces = io.getClass().getInterfaces();
20         
21         Iopreation newProxyInstance = (Iopreation)Proxy.newProxyInstance(Iopreation.class.getClassLoader(), io.getClass().getInterfaces(), new LogInvocationHandler(io));
22         
23         System.out.println(newProxyInstance.getClass().getName());
24          
25         newProxyInstance.drive("奔驰");
26         newProxyInstance.sayHello();
27     }
28 
29 }

 

【JVM系列】:(一)虚拟机内存结构

原文:http://www.cnblogs.com/zht101/p/7600762.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!