java初学求助!!

seraphmk2 2002-02-08 06:51:07
thinking in java第7章练习求救!!
Create an abstract class with no methods. Derive a class and add a method. Create a static method that takes a reference to the base class, downcasts it to the derived class, and calls the method. In main( ), demonstrate that it works. Now put the abstract declaration for the method in the base class, thus eliminating the need for the downcast.

题目里的Create a static method that takes a reference to the base class是说要建立一个使用基础类对象作为参数的方法吧?但基础类是一个抽象的类,那就不能建立一个它的对象啊~那又如何来进行下溯造型呢??如果先把一个它的子类上溯为参数再来下溯的话,好像有点无聊...实在是不懂,请各位高人指教!!
...全文
42 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧