|
3Java金币
interface ICellPhone
{
void sendMessage();
}
class Iphone implements ICellPhone
{
public void sendMessage(){
System.out.println("Iphone发送信息");
}
}
class Android implements ICellPhone
{
public void sendMessage(){
System.out.println("Android发送信息");
}
}
public class FactoryDemo
{
public static void main(String[] agrs){}
ICellPhone i = new Iphone();
i.sendMessage();
ICellPhone a = new Android();
a.sendMassage();
}
错误提示:
---------- javac ----------
FactoryDemo.java:21: 需要 <标识符>
i.sendMessage(); //21行,出现错误
^
FactoryDemo.java:23: 需要 <标识符>
a.sendMassage(); //23行,出现错误
^
2 错误
输出完成 (耗时 0 秒) - 正常终止
|
|