PHP/Java Bridge:PHP extend继承Java的interface,Java的interface直接在PHP实现
程序员文章站
2022-05-17 17:30:24
...
package test;
publicclassHelloWorld {publicHelloWorld(String args) {
}
publicvoidset(HWinterface hw){
System.out.println(hw.getClass());//class com.sun.proxy.$Proxy0
hw.pppp();//在命令行打印!!!!!
}
publicstaticfinal String JAVABRIDGE_PORT = "28080";// 这个8080端口是Java.inc里指定的staticfinal php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner
.getInstance(JAVABRIDGE_PORT);
publicstaticvoidmain(String args[]) throws Exception {
runner.waitFor();
}
}
package test;
publicinterface HWinterface {
publicvoidpppp();
}
require_once("/home/gt/workspace/JavaPhp/Java.inc");
usetest\HWinterface;
usetest\HelloWorld;
classabc2extendsHelloWorld{
}
classabcextendsHWinterface{function__construct($a){}
functionpppp(){echo"!!!!!\n";
}
}
$hw =new abc2("temp");
$a = new abc("temp");
$b = java_closure($a,null,java("test.HWinterface"));//看API+源码自己实现的精华部分$hw -> set($b);
').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
以上就介绍了PHP/Java Bridge:PHP extend继承Java的interface,Java的interface直接在PHP实现,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。