abstract class Door {
abstract void open();
abstract void close();
}
interface Alarm {
void alarm();
}
class AlarmDoor extends Door implements Alarm {
void open() { … }
void close() { … }
void alarm() { … }
}
abstract void open();
abstract void close();
}
interface Alarm {
void alarm();
}
class AlarmDoor extends Door implements Alarm {
void open() { … }
void close() { … }
void alarm() { … }
}
解决方案 »
- 判断字符串A中是否包含字符串B的问题,使用contains…………
- java编译简单绘图功能软件?--=
- 小程序, 问题好像就出在第二个源文件的赋值语句里,但不知道怎么改??
- 谁来改改这个问题的错误?
- 如何监听java应用程序被用户通过"结束进程"关闭
- oracle中可不可以跟踪对数据库的操作
- 很菜的java基础问题
- 静态方法package org.sean.module03;
- 安装sql 2000 for jdbc的驱动后该怎样设置呢?
- Help:JSWDK1.0.1, Out of environment space?
- 用jakarta poi来操作excel电子表格时的中文问题,难道它就不支持中文?我想还是编码问题,查找原码,还是没找到原因!!快帮帮手
- 菜鸟级问题^——^学习JAVA,要C语言基础吗?
public void doAct();
}public class Test implements Inter{ //实现了Inter接口
public void doAct(){
System.out.println("do action");
} public void static main(String[] args){
Inter in = new Test(); //可以做接口的引用,但不能直接实例化接
口,但可以用实现来。
in.doAct();
}
}
String s; //public static
}
??
public void doAct();
}public class Test implements Inter{ //实现了Inter接口
public void doAct(){
System.out.println("do action");
} public void static main(String[] args){
Inter in = new Test(); //可以做接口的引用,但不能直接实例化接
口,但可以用实现来。
in.doAct();
}
}
}class b implements a{}class c {
function c(){
a = new b();
}
}
{
public int exec();
}class Return
{
public MyInterface exec()
{
return ( new MyInterface()
{
public int exec()
{
return 1;
}
}
);
}
}public class TestInterface
{
public static final void main( String[] argv )
{
Return aReturn = new Return();
MyInterface aMyInterface = aReturn.exec();
java.lang.System.out.println( "return value: " + aMyInterface.exec() );
}
}
调用结果
return value: 1