| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 432 人关注过本帖
标题:求助 怎么还错啊??
只看楼主 加入收藏
hym_19820718
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-21
收藏
 问题点数:0 回复次数:5 
求助 怎么还错啊??

public interface InterfaceExample{
final int X;
void a();
void b();
}
class example implements public interface InterfaceExample{
final int X;
void a();
void b();
}
class example implements InterfaceExample{
void a(){
System.out.println("i lou");
}
}
public class Main {

public static void main(String[] args) {
Example example = new Example();
example.a();
}
}
{
void a(){
System.out.println("i love china");
}
}
public class Main {

public static void main(String[] args) {
Example example = new Example();
example.a();
}
}
错在哪里了 ?InterfaceExample这个接口有错误吗?

2006-01-12 23:23
hym_19820718
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-21
收藏
得分:0 

public interface InterfaceExample{
final int X;
void a();
void b();
}
class example implements InterfaceExample{
void a(){
System.out.println("i lou");
}
}
public class Main {

public static void main(String[] args) {
Example example = new Example();
example.a();
}
}
不好意思 粘多了! 错在哪里了??

2006-01-12 23:25
飘飘叶子
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:597
专家分:10
注 册:2005-8-17
收藏
得分:0 
三个public类,1个interface,2个有main函数……这个程序没法看了……

向着软件工程师的目标前进!
2006-01-12 23:32
时空之蕊
Rank: 2
等 级:新手上路
威 望:3
帖 子:691
专家分:0
注 册:2004-10-31
收藏
得分:0 
我来看啊!==

我渴望掌控时空的核心——用最先进的技术,打造无比美丽的世界!
2006-01-13 00:12
时空之蕊
Rank: 2
等 级:新手上路
威 望:3
帖 子:691
专家分:0
注 册:2004-10-31
收藏
得分:0 
错误简单啊,接口必须被实现!

public interface InterfaceExample{
final int X;
void a();
void b();//没有在example中实现
}
class example implements InterfaceExample{
void a(){
System.out.println("i lou");
}
}
public class Main {

public static void main(String[] args) {
Example example = new Example();//似乎类名在声明时没有大写
example.a();
}
}


我渴望掌控时空的核心——用最先进的技术,打造无比美丽的世界!
2006-01-13 00:15
bagger
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:33
帖 子:891
专家分:0
注 册:2005-8-16
收藏
得分:0 
也是不对,

如果不是抽象类继承接口,那就得把接口里的方法全部实现,要不也不能通过编译!
得在EXAMPLE中把B()也实现才算完事!!!


【三元毕业设计论文】
三元论文真的只有三元钱
客服QQ:742670649
http://shop35094218./
2006-01-13 08:47
快速回复:求助 怎么还错啊??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018417 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved