⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 例6.10.txt

📁 《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌-源程序
💻 TXT
字号:
//例6.10:构造方法中的多态方法举例:
abstract class Glyph
{
  abstract void draw();
  Glyph()
  {
    System.out.println("Glyph() before drow()");
    draw();
    System.out.println("Glyph() before drow()");
   }
}
class RoundGlyph extends Glyph
{
  int radius=1;
  RoundGlyph(int r)
  {
    radius=r;
    System.out.println("RoundGlyph.RoundGlyph(),radius="+radius);
   }
   void draw()
   {
    System.out.println("RoundGlyph.draw(),radius="+radius);   
   }
}
public class PolyConstructors
{
  public static void main(String[] args)
  {
    new RoundGlyph(5);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -