Demo entry 6349826

main

   

Submitted by anonymous on Feb 28, 2017 at 12:11
Language: Java. Code size: 462 Bytes.

package com.study.designpattern.proxy;

import java.lang.reflect.Proxy;

final class Client {

	public static void main(String[] args)  throws Exception{
		// TODO Auto-generated method stub
		Subject realSubject = new RealSubject();
		Subject proxy = (Subject) Proxy.newProxyInstance(Subject.class.getClassLoader(),
				new Class[]{Subject.class}, 
				new ProxyHandler(realSubject));
		//proxy.doSomething("吃饭");
		int a = proxy.sum(1,2);
	}

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).