class Test
{
public void print()
{
System.out.println("test print");
}
}
abstract class AbTest extends Test
{
abstract public void print();
}
class SuperTest extends AbTest
{
public void print()
{
System.out.println("Supert printer");
}
}
--------------------编程问答--------------------
是啊 我也想不出什么正常情况需要这么反着用的
--------------------编程问答--------------------
不知道楼主学习什么资料,也许这在Java中是一个不好的实践吧,我们没有理由去这么实践的,除非该书本为了将抽象类的易做图标新立异~
--------------------编程问答--------------------
It is useful only when your extended abstract class (sounds weird...) wants to make its extended classes to override the default implementation from the ancestor class.
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
}
--------------------编程问答--------------------
... stupid system publishes automatically when I accidentally hit Ctrl+Enter, and it never lets me amend what I published!
Well.. you get the idea
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
print("I 易做图 men and women!");
}
}
--------------------编程问答--------------------
顶!
--------------------编程问答--------------------
It is useful only when your extended abstract class (sounds weird...) wants to make its extended classes to override the default implementation from the ancestor class.
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
}
... stupid system publishes automatically when I accidentally hit Ctrl+Enter, and it never lets me amend what I published!
Well.. you get the idea
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
print("I 易做图 men and women!");
}
}
It is useful only when your extended abstract class (sounds weird...) wants to make its extended classes to override the default implementation from the ancestor class.
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
}
... stupid system publishes automatically when I accidentally hit Ctrl+Enter, and it never lets me amend what I published!
Well.. you get the idea
class Man {
public void 易做图() {
print ("I 易做图 girls!");
}
}
abstract class AbnormalMan extends Man {
public abstract void 易做图();
}
class Gay extends AbnormalMan {
public void 易做图() {
print("I 易做图 men!");
}
}
class Bi易做图ualMan extends AbnormalMan {
public void 易做图() {
print("I 易做图 men and women!");
}
}
In Java, subclassing is often used to provide missing implementation of a method declared
in an abstract parent class; the subclass thus becomes a concrete class with fully
defined behaviour. The opposite is also allowed: a subclass of the concrete class can be
declared abstract, and some of the parent class methods can be overridden and declared
abstract. Give your ideas on why and when such subclassing can be useful.