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

📄 bullet.java

📁 本程序是用多线程实现了打飞鸟游戏程序
💻 JAVA
字号:
/*
 * bullet.java
 *
 * Created on 2007年12月28日, 下午2:19
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package shoot_birds;

/**
 *
 * @author open
 * 子弹类
 * 主要用于子弹计数,初始值为100
 * 这里用到单身设计模式
 */
class Bullet {
    
   
    private  Bullet() {//构造器是私有的
    }
    public static Bullet getInstance()//得到单身模式的实例
    {
        if(bullet==null)
            bullet=new Bullet();
        return bullet;
    }
    //得到子弹的数目
    public int getNum()
    {
        return num;
    }
    //射击的时候,也就是鼠标单击,子弹数目减减
    public void setNum()
    {
        num--;
    }
    private static Bullet bullet;
    private int num=100;
}

⌨️ 快捷键说明

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