一点语法问题,各位达人都近来看呀! new A extend B{//...}.method(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 按你的要求,新类A必须为匿名类,则:public class TestInheri{ class B { void sayHello() { System.out.println("hello!"); } } void test() { new B(){ }.sayHello(); } public static void main(String[] args) { new TestInheri().test(); }} “ gdsean(摇滚java) ( ) ”在语法上是错误的。是不能通过的。 匿名类是不能extends/implements的 new A extends B(){}.method();这样子可以吗? 回复人: shine333(shine) ( ) 信誉:100 2003-08-19 15:16:00 得分:0 匿名类是不能extends/implements的 ========================================================================原来是这样啊我本来想用DateFormat.parse(string)这个方法的,结果发现DateFormat是abstract的。现在我直接用SimpleDateFormat了,SUN想的挺周到的,呵呵 \r,\n,\r\n的问题 如何给这个程序解耦合,有点挑战性。 不长用汉字乱码问题,oracle显示正常 高分请教一个问题,帮忙啊! BigDecimal如何让1000000格式化为1.000.000 JScrollPane 与ScrollPane的区别(参与有分) import采用指定到单个文件好,还是用*好? wls 7中关于word的问题 我要学java80分相送 保证送分,请进来看 一个源码,出了三个错误,搞了好长时间搞不错了,帮忙看一下 overriding and overloading
新类A必须为匿名类,则:
public class TestInheri
{
class B
{
void sayHello()
{
System.out.println("hello!");
}
}
void test()
{
new B(){ }.sayHello();
}
public static void main(String[] args)
{
new TestInheri().test();
}
}
在语法上是错误的。是不能通过的。
匿名类是不能extends/implements的
========================================================================
原来是这样啊
我本来想用DateFormat.parse(string)这个方法的,结果发现DateFormat是abstract的。
现在我直接用SimpleDateFormat了,SUN想的挺周到的,呵呵