java study 003--the method is the same, resolve way---inner class
来源:互联网 发布:oracle数据字典怎么用 编辑:程序博客网 时间:2024/06/08 09:22
interface Machine
{
void run();
}
class persion
{
void run()
{
System.out.println("persion run");
}
}
//当一个类继承的类和实现的接口中的方法重复时,可以用内部类去解决
class robet extends persion
{
class machinhear implements Machine
{
public void run()
{
System.out.println("machine run");
}
}
public Machine getMachine()
{
return new machinhear();
}
}
public class testMachin {
public static void main(String[] args) {
robet r = new robet();
Machine m = r.getMachine();
m.run();
r.run();
}
}
public class testMachin {
static void meth1(A a)
{
a.f1();
}
static void meth2(B b)
{
b.f2();
}
public static void main(String[] args) {
/*robet r = new robet();
Machine m = r.getMachine();
m.run();
r.run();*/
C c= new C();
B b = c.gerb();
meth1(c);
meth2(b);
}
}
class A
{
void f1()
{}
}
abstract class B
{
abstract void f2();
}
class C extends A
{
B gerb()
{
return new B() {
@Override
void f2() {
// TODO Auto-generated method stub
}
};
}
}
- java study 003--the method is the same, resolve way---inner class
- the only way is independent in your study
- java study 002 --inner class
- the “inner class” idiom
- Spring - the way in the study
- What is the study?
- The method load(Class, Serializable) in the type Session is not applicable for the arguments (Class<
- C coding study on the way-1
- This is class com.phonecontact.UpdateContactServlet, using the POST method
- OpenSolaris is on the way
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (GameV
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the问题
- The method getTextContent() is undefined for the type NodeXMLParse.java
- JAVA on the way
- java.io.IOException: The same input jar is specified twice.
- java.io.IOException: The same input jar is specified twice”
- he method get(Class, Serializable) in the type HibernateTemplate is not applicable for the arguments
- The method newJob(Class<QuartzTest>) is undefined for the type Test
- 解决VS2008 开发Windows Mobile 项目生成速度慢的问题
- vbox上新建redhat linux系统启动报错
- Warning[Pa082]:undefined behavior: the order of volatile accesses is undefined in this statement
- 黑马程序员---C#中关于方法的重写
- 数据结构:单链表的实现与Joseph环
- java study 003--the method is the same, resolve way---inner class
- 乾坤大挪移——使用PQ分区魔术师扩大C盘空间
- CMOS跳线短接后,开机密码仍存在解决方法
- linux Chmod 使用
- android 加载图片轻松避免OOM(out of memory) 支持设置缓存大小,不再强制catch OOM
- 当你扛不住的时候就读一遍,其实人在最痛苦的时候意味着马上成功。
- 在GitHub上分享和展示你的代码
- Prototype Pattern
- 中国软件服务外包IT公司最新排名-IT外包最强前50名