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

📄 testbird.java

📁 所学课程的编码。java的基础例子。可以练习java通过这些例子。。
💻 JAVA
字号:
/*
 * David Java File Created on 2006-10-7
 * 
 * TODO To change the template for this generated file go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
package chap04;

abstract class Bird {
    String food = "grain";
    abstract void fly();
    protected void eat(){
        System.out.println("eat " + food);  
    }
}

class BLBird extends Bird {
    String food = "leaf";
    public void fly() {
        System.out.println("BLBird fly");
    }
    public void eat(){
 	   System.out.println("eat " + food); 
    }
    
    
    public String eat(String a){
	   System.out.println("eat " + a); 
	   return a;
    }
   
    void bite(){
        System.out.println("bite " + food);  
    }
    public void sing(){
        System.out.println("BLBird sing a song");
    }
    public String sing(String name){
        System.out.println("BLBird sing a song:"+name);
        return name;
    }
}

public class TestBird {

    public static void main(String[] args) {
        BLBird aBird = new BLBird();
        aBird.fly();
        //aBird.eat();
        //aBird.eat("aaa");
        //aBird.bite();
        //aBird.sing();
        //aBird.sing("JHT");
        
    }
    protected  void aa(){
    	System.out.println("Test protected method.");
    }
}

⌨️ 快捷键说明

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