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

📄 sample9_2.java

📁 Java SE 6.0前11章示的示例代码,简单易学
💻 JAVA
字号:
package wyf.jc;
interface Flyer
{
	//HIGH、MIDDLE、LOW分别表示高空,中等,低空飞行
	public static final int HIGH=1;
	public static final int MIDDLE=2;
	public static final int LOW=3;
}
class AirPlane implements Flyer
{
	public void setFlyHeight(int height)
	{
		switch(height)
		{ //判断处在何种飞行状态
			case HIGH:
				System.out.println("我现在处在高空飞行状态!!!");
				break;
			case MIDDLE:
				System.out.println("我现在处在中等高度飞行状态!!!");
				break;
			case LOW:
				System.out.println("我现在处在低空飞行状态!!!");
				break;						
		}
	}
}
public class Sample9_2
{
	public static void main(String[] args)
	{
		//创建对象,调用方法
		AirPlane ap=new AirPlane();
		ap.setFlyHeight(Flyer.LOW);
	}
}

⌨️ 快捷键说明

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