java實(shí)現(xiàn)飛機(jī)大戰(zhàn)小游戲
更新時間:2022年06月06日 16:41:13 作者:青檸L?wenzahn?m.
這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)飛機(jī)大戰(zhàn)小游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了java實(shí)現(xiàn)飛機(jī)大戰(zhàn)游戲的具體代碼,供大家參考,具體內(nèi)容如下
MyPanel類
package ?P; import java.awt.Font; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import java.util.List; import javax.sql.RowSetInternal; import javax.swing.ImageIcon; import javax.swing.JPanel; //xx.2 //創(chuàng)建面板類,繼承面板,實(shí)現(xiàn)移動監(jiān)聽事件 public class MyPanel extends JPanel implements MouseMotionListener { ?? ?//private ImageIcon bjImage = new ImageIcon("img/bj.png"); ?? ? ?? ?//英雄機(jī)圖片 ?? ?private ImageIcon heroImage = new ImageIcon("img/頭.png");? ?? ? ?? ?//顯示logo ?? ?//private ImageIcon logoImage = new ImageIcon("img/頭.png"); ?? ? ?? ?//英雄機(jī)的寬高 ?? ?private int width = heroImage.getIconWidth(); ?? ?private int height = heroImage.getIconHeight(); ?? ? ?? ?//英雄機(jī)的坐標(biāo) ?? ?private int x=180; ?? ?private int y=880; ?? ? ?? ?//創(chuàng)建一個敵機(jī)的集合,用于展示多個敵機(jī) ?? ?List<Enemy> enemys = new ArrayList<>(); ?? ?//存儲子彈集合 ?? ?List<Bullet> bullets = new ArrayList<>(); ?? ?//存儲爆炸對象集合 ?? ?List<Bomb> bombs = new ArrayList<>();?? ? ?? ?//存儲英雄機(jī)爆炸集合 ?? ?List<HeroDead> heroDeads = new ArrayList<>(); ?? ? ?? ?private int number;//統(tǒng)計當(dāng)前得分 ?? ?private int m;//統(tǒng)計剩余血條量 ?? ? //?? ?MyPanel jp = new MyPanel() { //?? ??? ?{ //?? ??? ??? ?setBackground(Color.gray);// 設(shè)置面板背景顏色 //?? ??? ?} ?? ? ?? ? ?? ?public MyPanel() { ?? ??? ?//在構(gòu)造方法中準(zhǔn)備10個敵機(jī) ?? ??? ?for(int i=0;i<10;i++){ ?? ??? ??? ?enemys.add(new Enemy()); ?? ??? ?} ?? ?} ?? ? ?? ?@Override ?? ?public void paint(Graphics g) { //用于繪制圖片區(qū)域 ?? ??? ?super.paint(g); ?? ??? ? ?? ??? ?//在窗口左側(cè)展示打飛機(jī)得分 ?? ??? ?//設(shè)置字體: 參數(shù)1:字體家族, 參數(shù)2:字體樣式:加粗 ? 參數(shù)3:字體大小 ?? ??? ?g.setFont(new Font("宋體", Font.BOLD, 30)); ?? ??? ?g.drawString("當(dāng)前得分:"+number, 5, 30); ?? ??? ?g.drawString("發(fā)量(萬根):"+(5-m), 5, 80); ?? ??? ?//g.drawImage(null, x, y, getBackground(), getFocusCycleRootAncestor()); ?? ??? ? ?? ??? ?//繪制英雄機(jī)圖片 ?參數(shù)1,圖片 ?參數(shù)2和3:坐標(biāo) ?? ??? ?g.drawImage(heroImage.getImage(), x, y, null); ?? ??? ? ?? ??? ?//g.drawImage(logoImage.getImage(), 19, 22, null); ?? ??? ? ?? ??? ?//在繪圖中顯示10輛敵機(jī) ?? ??? ?for(int i=0;i<enemys.size();i++){ ?? ??? ??? ?Enemy enemy = ?enemys.get(i); ?//獲取敵機(jī)對象 ?? ??? ??? ?enemy.drawImage(g); ? ? //然后分別展示 ?? ??? ?} ?? ??? ? ?? ??? ?//展示子彈集合的圖片 ?? ??? ?for (int i = 0; i < bullets.size(); i++) { ?? ??? ??? ?Bullet bullet = bullets.get(i); ?//取出子彈對象 ?? ??? ??? ?bullet.drawImage(g); ?? ??? ?} ?? ??? ? ?? ??? ?//展示爆炸集合的圖片 ?? ??? ?for(int i=0;i<bombs.size();i++){ ?? ??? ??? ?Bomb bomb = bombs.get(i); ?? ??? ??? ?bomb.drawImage(g); ?? ??? ?} ?? ??? ? ?? ??? ?//展示英雄機(jī)的銷毀圖片 ?? ??? ?for(int i=0;i<heroDeads.size();i++){ ?? ??? ??? ?HeroDead heroDead = heroDeads.get(i); ?? ??? ??? ?heroDead.drawImage(g); ?? ??? ?} ?? ??? ? ?? ?} ?? ?@Override ?? ?public void mouseDragged(MouseEvent e) { ?? ??? ?//System.out.println("鼠標(biāo)移動并拖拽觸發(fā)"); ?? ??? ? ?? ??? ?//鼠標(biāo)拖拽時,需要將英雄機(jī)也帶著移動(只需改變x軸和y軸) ?? ??? ?x = e.getX()-width/2; ?//英雄機(jī)的移動,隨著鼠標(biāo)觸發(fā)移動的 ?? ??? ?y = e.getY()-height/2; ?//鼠標(biāo)指定到英雄機(jī)中間位置 ?? ??? ? ?? ??? ?repaint(); ?//重新繪制圖片 ?? ?} ?? ?@Override ?? ?public void mouseMoved(MouseEvent e) { ?? ??? ?//System.out.println("鼠標(biāo)移動的觸發(fā).."); ?? ??? ? ?? ??? ?//鼠標(biāo)移動時,需要將英雄機(jī)也帶著移動(只需改變x軸和y軸) ?? ??? ?x = e.getX()-width/2; ?//英雄機(jī)的移動,隨著鼠標(biāo)觸發(fā)移動的 ?? ??? ?y = e.getY()-height/2; ?//鼠標(biāo)指定到英雄機(jī)中間位置 ?? ??? ? ?? ??? ?repaint(); ?//重新繪制圖片 ?? ?} ?? ?//L-4. 創(chuàng)建子彈類Bullet,操作與敵機(jī)類類似 ?? ?public void init() { ?? ??? ?//定義一個標(biāo)記,循環(huán)了自定義的次數(shù)后,才去添加,這樣子彈數(shù)量會變少 ?? ??? ?int flag = 0; ?? ??? ?while(true) { //循環(huán)地跑,模擬依次移動的效果 ?? ??? ??? ?flag++; ?// ?? ??? ??? ?if(flag==50) { ?//控制子彈數(shù)量 ?? ??? ??? ??? ? ?? ??? ??? ? ?bullets.add(new Bullet(x+width/2, y)); //就是從英雄級的x,y軸位置發(fā)射子彈的 ?? ??? ??? ?? ?? ??? ??? ? ?flag=0; ?//又回到0,依次計算15次 ?? ??? ??? ? ?//System.out.println("子彈數(shù)量:"+ bullets.size()); ?? ??? ??? ?} ?? ??? ??? ??? ??? ??? ? ?? ??? ??? ?//展示子彈,讓子彈飛起來 ?? ??? ??? ?for(int i=0;i<bullets.size();i++) { ?? ??? ??? ? ?? ?Bullet bullet = bullets.get(i); ?//取出對象 ?? ??? ??? ? ?? ?if(i%2!=0)//設(shè)置子彈左右發(fā)射 ?? ??? ??? ? ?? ?bullet.move(); ? ?? ??? ??? ? ?? ?else ?? ??? ??? ? ?? ?bullet.move1();//移動子彈位置 ?? ??? ??? ? ?? ? ?? ??? ??? ? ?? ? ?? ??? ??? ? ?? ?//如果子彈移動到y(tǒng)軸為0,則移除掉 ?? ??? ??? ? ?? ?if(bullet.getY()<0){ ?? ??? ??? ? ?? ??? ?bullets.remove(bullet); ?//移除子彈對象 ?? ??? ??? ? ?? ?} ?? ??? ??? ?} ?? ??? ??? ?//xx.3. ?? ??? ??? ?//敵機(jī)循環(huán)移動.. ?? ??? ??? ?for(int i=0;i<enemys.size();i++) { ?? ??? ??? ??? ?Enemy en = enemys.get(i); ?? ??? ??? ??? ?en.move(); ?//循環(huán)地移動每一架敵機(jī)y軸位置 ?? ??? ??? ??? ? ?? ??? ??? ??? ? ?? ??? ??? ??? ?//超出屏幕范圍后,需要移除,并重新添加一個對象 ?? ??? ??? ??? ?if(en.getY()>GameMain.HEIGHT) { ?? ??? ??? ??? ??? ?//int count1=enemys.size(); ?? ??? ??? ??? ??? ?enemys.remove(en); ? //移除對象 ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?enemys.add(new Enemy()); ?//重新再創(chuàng)建對象 ?? ??? ??? ??? ?} ?? ??? ??? ??? ? ?? ??? ??? ?//L 3-4?? ? ?? ??? ??? ??? ?//在敵機(jī)的循環(huán)中,再繼續(xù)循環(huán)子彈; 需要判斷是否有子彈和敵機(jī)重疊了, ?? ??? ??? ??? ?//則移除敵機(jī)對象,重新添加,移除子彈;如果有則添加爆炸對象 ?? ??? ??? ??? ?for(int j=0;j<bullets.size();j++){ ?? ??? ??? ??? ??? ?Bullet bu = bullets.get(j); ?? ??? ??? ??? ??? ?if(isHit(en,bu)){ //碰撞的判斷 ?? ??? ??? ??? ??? ??? ?enemys.remove(en); ?//移除敵機(jī),并重新new一個 ?? ??? ??? ??? ??? ??? ?enemys.add(new Enemy()); ?? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ?bullets.remove(bu); ?//移除子彈 ?? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ?//添加的爆炸位置和敵機(jī)位置一致 ?? ??? ??? ??? ??? ??? ?bombs.add(new Bomb(en.getX(), en.getY())); ?? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ?number += 10; //爆炸后,累加得分 ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ?} ?? ??? ??? ??? ?//zz-6 ?? ??? ??? ??? ?//判斷英雄機(jī)與敵機(jī)的碰撞(英雄機(jī)的消亡) ?? ??? ??? ??? ?if(isHit(en)){ ?? ??? ??? ??? ??? ?System.out.println("進(jìn)入英雄機(jī)爆炸..."); ?? ??? ??? ??? ??? ?//敵機(jī)的對象移除 ?? ??? ??? ??? ??? ?enemys.remove(en); ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?//英雄機(jī)爆炸圖片位置應(yīng)該與英雄機(jī)重疊 ?? ??? ??? ??? ??? ?heroDeads.add(new HeroDead(x, y)); ?? ??? ??? ??? ??? ?for(m=0;m<=heroDeads.size();m++) { ?? ??? ??? ??? ??? ??? ?while(heroDeads.size()==5) { ?? ??? ??? ??? ??? ??? ??? ?return;? ?? ??? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?//游戲結(jié)束,跳出死循環(huán) ?? ??? ??? ??? ?} ?? ??? ??? ?} ?? ??? ??? ?//L-5 ?? ??? ??? ?//將爆炸的所有對象,過一段時間則干掉 ?? ??? ??? ?for(int i=0;i<bombs.size();i++){ ?? ??? ??? ??? ?Bomb bomb = bombs.get(i); ?? ??? ??? ??? ?bomb.move(); ?//計算次數(shù),統(tǒng)一循環(huán)多少次后,再干掉 ?? ??? ??? ??? ? ?? ??? ??? ??? ?if(bomb.getCount()>6){ ?? ??? ??? ??? ??? ?bombs.remove(bomb); ?//在循環(huán)的一定范圍后,可以移除爆炸了 ?? ??? ??? ??? ?} ?? ??? ??? ?} ?? ??? ??? ? ?? ??? ??? ?//xx.2 ?? ??? ??? ?//每次的移動都需要停頓一下 ?? ??? ??? ?try { ?? ??? ??? ??? ?Thread.sleep(6); ? ?//單位:毫秒 ?睡眠6毫秒 ?? ??? ??? ?} catch (InterruptedException e) { ?? ??? ??? ??? ?e.printStackTrace(); ?? ??? ??? ?}? ?? ??? ??? ? ?? ??? ??? ?repaint(); ?//重新繪制圖片 ?? ??? ?} ?? ?} ?? ? ?? ? ?? ? ?? ? //zz-6 ?? ? //英雄機(jī)與敵機(jī)的碰撞 ?? ?private boolean isHit(Enemy en) { ?? ??? ?//英雄機(jī)的碰撞區(qū)域 ?? ??? ?Rectangle rect = new Rectangle(x, y, width, height); ?? ??? ?//碰撞點(diǎn)的位置,是在敵機(jī)的中心點(diǎn) ?? ??? ?Point point = new Point(en.getX()+en.getWidth()/2, en.getY()+en.getHeight()/2); ?? ??? ? ?? ??? ?return rect.contains(point); ?? ?} ?? ? ?? ? ?? ?//L-5 ?? ?private boolean isHit(Enemy en, Bullet bu) { ?? ??? ?//填充敵機(jī)的碰撞區(qū)域 ?? ??? ?Rectangle rect = new Rectangle(en.getX(), en.getY(), en.getWidth(), en.getHeight()); ?? ??? ?//將子彈的位置設(shè)置在中間 ?? ??? ?Point point = new Point(bu.getX()+bu.getWidth()/2, bu.getY()+bu.getHeight()/2); ?? ??? ?//如果位置有重疊,返回true ?? ??? ?return rect.contains(point); ?? ?} }
HeroDead類
package ?P; import java.awt.Graphics; import javax.swing.ImageIcon; public class HeroDead { ?? ?private ImageIcon heroImage = new ImageIcon("img/爆炸.gif"); ?? ?private int width = heroImage.getIconWidth(); ?? ?private int height = heroImage.getIconHeight(); ?? ?private int x; ?? ?private int y; ?? ? ?? ? ?? ? ?? ?public ImageIcon getHeroImage() { ?? ??? ?return heroImage; ?? ?} ?? ?public void setHeroImage(ImageIcon heroImage) { ?? ??? ?this.heroImage = heroImage; ?? ?} ?? ?public int getWidth() { ?? ??? ?return width; ?? ?} ?? ?public void setWidth(int width) { ?? ??? ?this.width = width; ?? ?} ?? ?public int getHeight() { ?? ??? ?return height; ?? ?} ?? ?public void setHeight(int height) { ?? ??? ?this.height = height; ?? ?} ?? ?public int getX() { ?? ??? ?return x; ?? ?} ?? ?public void setX(int x) { ?? ??? ?this.x = x; ?? ?} ?? ?public int getY() { ?? ??? ?return y; ?? ?} ?? ?public void setY(int y) { ?? ??? ?this.y = y; ?? ?} ?? ?public HeroDead(int x,int y){ ?? ??? ?this.x=x; ?? ??? ?this.y=y; ?? ?} ?? ?public void drawImage(Graphics g) { ?? ??? ?g.drawImage(heroImage.getImage(), x, y, null); ?? ?} }
GameMain類
package ?P; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JFrame; //游戲入口類 public class GameMain { ?? ?static final int WIDTH = 860; ?//設(shè)置靜態(tài)常量,作為狀態(tài)值使用 ?? ?static final int HEIGHT = 660; ?? ?public static void main(String[] args) { ?? ??? ?JFrame jFrame = new JFrame(); ?//實(shí)例化頂級窗口類 ?? ??? ?jFrame.setSize(WIDTH, HEIGHT); ?//設(shè)置寬高像素 ?? ??? ?jFrame.setTitle("小禿頭歷險記"); ?//設(shè)置標(biāo)題 ?? ??? ?jFrame.setLocationRelativeTo(null); ?//設(shè)置居中效果 ?? ??? ?//JFrame.EXIT_ON_CLOSE: 狀態(tài)值 ?3 ?? ??? ?jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //關(guān)閉窗口的同時,把程序關(guān)閉 ?? ??? ? ?? ??? ?//在窗口中,加入面板 ?? ??? ?MyPanel pl = new MyPanel(); ?? ??? ?pl.setBackground(Color.pink); ?? ??? ?pl.setBorder(BorderFactory.createLineBorder(Color.cyan, 3)); ?? ??? ?jFrame.add(pl); ?//添加面板組件 ?? ??? ?jFrame.addMouseMotionListener(pl); ?//添加鼠標(biāo)移動事件 ? ?? ??? ? ?? ??? ?jFrame.setVisible(true); ?//使窗口可視化 ?? ??? ? ?? ??? ?pl.init(); ?//在面板中循環(huán)將組件跑起來 ?? ?} }
Enemy類
package ?P; import java.awt.Graphics; import java.util.Random; import javax.swing.ImageIcon; //創(chuàng)建敵機(jī)類 public class Enemy { ?? ?//創(chuàng)建敵機(jī)圖片,寬高,坐標(biāo)等屬性 ?? ?private ImageIcon enemyImage = new ImageIcon("img/錯誤.png"); ?? ? ?? ?private int width = enemyImage.getIconWidth(); ?? ?private int height = enemyImage.getIconHeight(); ?? ? ?? ?private int x; ?? ?private int y; ?? ? ?? ?public ImageIcon getEnemyImage() { ?? ??? ?return enemyImage; ?? ?} ?? ?public void setEnemyImage(ImageIcon enemyImage) { ?? ??? ?this.enemyImage = enemyImage; ?? ?} ?? ?public int getWidth() { ?? ??? ?return width; ?? ?} ?? ?public void setWidth(int width) { ?? ??? ?this.width = width; ?? ?} ?? ?public int getHeight() { ?? ??? ?return height; ?? ?} ?? ?public void setHeight(int height) { ?? ??? ?this.height = height; ?? ?} ?? ?public int getX() { ?? ??? ?return x; ?? ?} ?? ?public void setX(int x) { ?? ??? ?this.x = x; ?? ?} ?? ?public int getY() { ?? ??? ?return y; ?? ?} ?? ?public void setY(int y) { ?? ??? ?this.y = y; ?? ?} ?? ?public Enemy(){ ?? ??? ?//創(chuàng)建隨機(jī)類,在窗口寬高范圍內(nèi)隨機(jī) ?? ??? ?Random random = new Random(); ?? ??? ?//隨機(jī)出來的敵機(jī)位置可以顯示一半圖片 ?? ??? ?x = random.nextInt(GameMain.WIDTH-width/2); ?? ??? ?y = -random.nextInt(GameMain.HEIGHT-height/2); ?//初始敵機(jī)位置為負(fù)數(shù) ?? ?} ?? ?public void drawImage(Graphics g) { ?? ??? ?//繪制敵機(jī)圖片 ?? ??? ?g.drawImage(enemyImage.getImage(), x, y, null); ?? ?} ?? ?public void move() { ?? ??? ?y +=2; ?//控制y軸速度 ?? ?} }
Bullet類
package ?P; import java.awt.Graphics; import javax.swing.ImageIcon; //創(chuàng)建子彈類 public class Bullet { ?? ?//創(chuàng)建屬性,子彈圖片,寬高,位置 ?? ?private ImageIcon bulletImage = new ImageIcon("img/aaa.gif"); ?? ? ?? ?private int width = bulletImage.getIconWidth(); ?? ?private int height = bulletImage.getIconHeight(); ?? ? ?? ?private int x; ?? ?private int y; ?? ? ?? ?public ImageIcon getBulletImage() { ?? ??? ?return bulletImage; ?? ?} ?? ?public void setBulletImage(ImageIcon bulletImage) { ?? ??? ?this.bulletImage = bulletImage; ?? ?} ?? ?public int getWidth() { ?? ??? ?return width; ?? ?} ?? ?public void setWidth(int width) { ?? ??? ?this.width = width; ?? ?} ?? ?public int getHeight() { ?? ??? ?return height; ?? ?} ?? ?public void setHeight(int height) { ?? ??? ?this.height = height; ?? ?} ?? ?public int getX() { ?? ??? ?return x; ?? ?} ?? ?public void setX(int x) { ?? ??? ?this.x = x; ?? ?} ?? ?public int getY() { ?? ??? ?return y; ?? ?} ?? ?public void setY(int y) { ?? ??? ?this.y = y; ?? ?} ?? ?public Bullet(int x,int y) { //x,y軸位置從外面?zhèn)魅耄ǖ扔谟⑿奂壍奈恢茫? ?? ??? ?this.x = x; ?? ??? ?this.y = y; ?? ?} ?? ?public void drawImage(Graphics g) { ?? ??? ?g.drawImage(bulletImage.getImage(), x, y, null); ?? ?} ?? ?public void move() { ?? ??? ?x-=1; ?? ??? ?y -= 2; ?//讓子彈y軸從下往上遞減 ?? ?} ?? ?public void move1() { ?? ??? ?x+=1; ?? ??? ?y -= 2; ?//讓子彈y軸從下往上遞減 ?? ?} }
爆炸類bomb類
package P; import java.awt.Graphics; import javax.swing.ImageIcon; //創(chuàng)建爆炸的實(shí)體了 public class Bomb { ?? ?//爆炸的圖片,寬高,位置屬性 ?? ?private ImageIcon bombImage=new ImageIcon("img/zz.png"); ?? ?private int width = bombImage.getIconWidth(); ?? ?private int height = bombImage.getIconHeight(); ?? ?private int x; ?? ?private int y; ?? ? ?? ?private int count; ?//記錄多少次數(shù)后爆炸 ?? ? ?? ?public ImageIcon getBombImage() { ?? ??? ?return bombImage; ?? ?} ?? ?public void setBombImage(ImageIcon bombImage) { ?? ??? ?this.bombImage = bombImage; ?? ?} ?? ?public int getWidth() { ?? ??? ?return width; ?? ?} ?? ?public void setWidth(int width) { ?? ??? ?this.width = width; ?? ?} ?? ?public int getHeight() { ?? ??? ?return height; ?? ?} ?? ?public void setHeight(int height) { ?? ??? ?this.height = height; ?? ?} ?? ?public int getX() { ?? ??? ?return x; ?? ?} ?? ?public void setX(int x) { ?? ??? ?this.x = x; ?? ?} ?? ?public int getY() { ?? ??? ?return y; ?? ?} ?? ?public void setY(int y) { ?? ??? ?this.y = y; ?? ?} ?? ?public int getCount() { ?? ??? ?return count; ?? ?} ?? ?public void setCount(int count) { ?? ??? ?this.count = count; ?? ?} ?? ?public Bomb(int x,int y){ ?? ??? ?this.x = x; ?? ??? ?this.y = y; ?? ?} ?? ?public void drawImage(Graphics g) { ?? ??? ?g.drawImage(bombImage.getImage(), x, y, null); ?? ?} ?? ?public void move() { ?? ??? ?count++; ?? ?} ?? ? }
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
用Rational Rose逆向工程(java)生成類圖(教程和錯誤解決)
Rational Rose有個很方便的功能,將項目中的JAVA代碼自動轉(zhuǎn)換成UML類圖2013-02-02JAVA實(shí)現(xiàn)的CrazyArcade泡泡堂游戲
CrazyArcade泡泡堂游戲,一款用Java編寫的JavaSwing游戲程序。 使用了MVC模式,分離了模型、視圖和控制器,使得項目結(jié)構(gòu)清晰易于擴(kuò)展,使用配置文件來設(shè)置游戲基本配置,擴(kuò)展地圖人物道具等。同時,該程序編寫期間用了單例模式、工廠模式、模板模式等設(shè)計模式。2021-04-04java虛擬機(jī)運(yùn)行時數(shù)據(jù)區(qū)分析
這篇文章主要介紹了java虛擬機(jī)運(yùn)行時數(shù)據(jù)區(qū)分析,具有一定參考價值,需要的朋友可以了解下。2017-11-11SpringCloud Eureka服務(wù)的基本配置和操作方法
Eureka是Netflix開源的一個基于REST的服務(wù)治理框架,主要用于實(shí)現(xiàn)微服務(wù)架構(gòu)中的服務(wù)注冊與發(fā)現(xiàn),Eureka是Netflix開源的服務(wù)發(fā)現(xiàn)框架,用于在分布式系統(tǒng)中實(shí)現(xiàn)服務(wù)的自動注冊與發(fā)現(xiàn),本文介紹SpringCloud Eureka服務(wù)的基本配置和操作方法,感興趣的朋友一起看看吧2023-12-12