欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java簡單實(shí)現(xiàn)銀行ATM系統(tǒng)

 更新時間:2022年05月27日 10:15:21   作者:息壤愛學(xué)習(xí)  
這篇文章主要為大家詳細(xì)介紹了Java簡單實(shí)現(xiàn)銀行ATM系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Java實(shí)現(xiàn)銀行ATM系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

實(shí)現(xiàn)步驟:

定義賬戶類,用于后期創(chuàng)建賬戶對象封裝用戶的賬戶信息。

賬戶類中的信息至少需要包含(卡號、姓名、密碼、余額、取現(xiàn)額度)

需要準(zhǔn)備一個ArrayList的集合,用于存儲系統(tǒng)用戶的賬戶對象。

定義一個系統(tǒng)啟動類ATMSystem需要展示歡迎頁包含2個功能:開戶功能、登錄賬戶。

賬戶類 Account

package test;
/*賬戶類*/
public class Account {
? ? private String cardId; //卡號
? ? private String userName; //客戶名字
? ? private String password; //密碼
? ? private double money; //余額
? ? private double quoteMoney; //當(dāng)次限額
? ? public Account(){}
? ? public Account(String cardId,String userName,String password,double quoteMoney){
? ? ? ? this.cardId = cardId;
? ? ? ? this.userName =userName;
? ? ? ? this.password = password;
? ? ? ? this.quoteMoney = quoteMoney;
? ? }

? ? public String getCardId() {
? ? ? ? return cardId;
? ? }

? ? public void setCardId(String cardId) {
? ? ? ? this.cardId = cardId;
? ? }

? ? public double getMoney() {
? ? ? ? return money;
? ? }

? ? public void setMoney(double money) {
? ? ? ? this.money = money;
? ? }

? ? public double getQuoteMoney() {
? ? ? ? return quoteMoney;
? ? }

? ? public void setQuoteMoney(double quoteMoney) {
? ? ? ? this.quoteMoney = quoteMoney;
? ? }

? ? public String getPassword() {
? ? ? ? return password;
? ? }

? ? public void setPassword(String password) {
? ? ? ? this.password = password;
? ? }

? ? public String getUserName() {
? ? ? ? return userName;
? ? }

? ? public void setUserName(String userName) {
? ? ? ? this.userName = userName;
? ? }
}

AtmSystem 類

package test;

import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class AtmSystem {
? ? public static void main(String[] args) {
? ? ? ? //用數(shù)組儲存賬戶對象
? ? ? ? ArrayList<Account> accounts = new ArrayList<>();
? ? ? ? //首頁:登錄 開戶
? ? ? ? showMain(accounts);
? ? }
? ? public static void showMain(ArrayList<Account> accounts){
? ? ? ? System.out.println("================歡迎進(jìn)入首頁界面===============");
? ? ? ? Scanner sc = new Scanner(System.in);
? ? ? ? while (true){
? ? ? ? ? ? System.out.println("請輸入您想要進(jìn)行的操作:");
? ? ? ? ? ? System.out.println("1.登錄");
? ? ? ? ? ? System.out.println("2.開戶");
? ? ? ? ? ? System.out.println("您可以輸入命令了:");
? ? ? ? ? ? int command = sc.nextInt();
? ? ? ? ? ? switch (command){
? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? ? ? //登錄
? ? ? ? ? ? ? ? ? ? login(accounts,sc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? ? ? //開戶
? ? ? ? ? ? ? ? ? ? register(accounts,sc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? default:
? ? ? ? ? ? ? ? ? ? System.out.println("您的輸入有誤!");
? ? ? ? ? ? }
? ? ? ? }
? ? }
// ? ? ? ? ? ?鍵盤錄入姓名、密碼、確認(rèn)密碼(需保證兩次密碼一致)
//
// ? ? ? ? ? ?生成賬戶卡號,卡號必須由系統(tǒng)自動生成8位數(shù)字(必須保證卡號的唯一)
//
// ? ? ? ? ? ?創(chuàng)建Account賬戶類對象用于封裝賬戶信息(姓名、密碼、卡號)
//
// ? ? ? ? ? ?把Account賬戶類對象存入到集合accounts中去。
? ? public static void register(ArrayList<Account> accounts,Scanner sc){
? ? ? ? System.out.println("===============用戶開戶================");
? ? ? ? System.out.println("請輸入開戶名稱:");
? ? ? ? String name = sc.next();
? ? ? ? String password = "";
? ? ? ? while (true){
? ? ? ? ? ? System.out.println("請輸入開戶密碼:");
? ? ? ? ? ? password = sc.next();
? ? ? ? ? ? System.out.println("請?jiān)俅未_認(rèn)密碼:");
? ? ? ? ? ? String okPassword = sc.next();
? ? ? ? ? ? //判斷兩次輸入密碼
? ? ? ? ? ? if (okPassword.equals(password)){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? System.out.println("兩次密碼必須一致");
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? System.out.println("請輸入當(dāng)次限額:");
? ? ? ? double quotaMoney = sc.nextDouble();
? ? ? ? String cardId = createCard(accounts);
? ? ? ? //封裝賬戶
? ? ? ? Account account = new Account(cardId,name,password,quotaMoney);
? ? ? ? accounts.add(account);
? ? ? ? System.out.println("恭喜您,開戶成功!你的卡號是:"+account.getCardId()+"請您妥善保管!");
? ? }
? ? public static String createCard(ArrayList<Account> accounts){
? ? ? ? while (true){
? ? ? ? ? ? //生成8位隨機(jī)號碼,且不重復(fù)
? ? ? ? ? ? String cardId = "";
? ? ? ? ? ? Random r = new Random();
? ? ? ? ? ? for (int i=0;i<8;i++){
? ? ? ? ? ? ? ? cardId += r.nextInt(10);
? ? ? ? ? ? }
? ? ? ? ? ? Account acc = getAccountByCardId(cardId, accounts);
? ? ? ? ? ? if (acc == null){
? ? ? ? ? ? ? ? return cardId;
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? public static Account getAccountByCardId(String cardId,ArrayList<Account> accounts){
? ? ? ? for (int i=0;i< accounts.size();i++){
? ? ? ? ? ? Account acc = accounts.get(i);
? ? ? ? ? ? if (acc.getCardId().equals(cardId)){
? ? ? ? ? ? ? ? return acc;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return null;
? ? }
? ? //登錄
// ? ? ? ? ? ?讓用戶鍵盤錄入卡號,根據(jù)卡號查詢賬戶對象。
//
// ? ? ? ? ? ?如果沒有找到了賬戶對象,說明卡號不存在,提示繼續(xù)輸入卡號。
//
// ? ? ? ? ? ?如果找到了賬戶對象,說明卡號存在,繼續(xù)輸入密碼。
//
// ? ? ? ? ? ?如果密碼不正確,提示繼續(xù)輸入密碼
//
// ? ? ? ? ? ?如果密碼正確,提示登陸成功!!
? ? public static void login(ArrayList<Account> accounts,Scanner sc){
? ? ? ? //判斷系統(tǒng)中是否存在賬戶
? ? ? ? if (accounts.size()==0){
? ? ? ? ? ? System.out.println("當(dāng)前系統(tǒng)查無此賬戶,請注冊!");
? ? ? ? ? ? return;
? ? ? ? }
? ? ? ? while (true){
? ? ? ? ? ? System.out.println("請輸入登錄賬號:");
? ? ? ? ? ? String cardId = sc.next();
? ? ? ? ? ? Account acc = getAccountByCardId(cardId,accounts);
? ? ? ? ? ? if (acc!=null){
? ? ? ? ? ? ? ? while (true){
? ? ? ? ? ? ? ? ? ? //輸入密碼
? ? ? ? ? ? ? ? ? ? System.out.println("請輸入密碼:");
? ? ? ? ? ? ? ? ? ? String password = sc.next();
? ? ? ? ? ? ? ? ? ? if (acc.getPassword().equals(password)){
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("恭喜您," + acc.getUserName() + "先生/女士成功登錄!" + "您的賬戶:" + acc.getCardId());
? ? ? ? ? ? ? ? ? ? ? ? //展示操作頁面
? ? ? ? ? ? ? ? ? ? ? ? showUserCommand(sc,acc,accounts);
? ? ? ? ? ? ? ? ? ? ? ? return;
? ? ? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("Sorry,該賬戶不存在!");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? private static void showUserCommand(Scanner sc, Account acc , ArrayList<Account> accounts) {
? ? ? ? while (true) {
? ? ? ? ? ? System.out.println("==================用戶操作界面===================");
? ? ? ? ? ? System.out.println("1、查詢賬戶");
? ? ? ? ? ? System.out.println("2、存款");
? ? ? ? ? ? System.out.println("3、取款");
? ? ? ? ? ? System.out.println("4、轉(zhuǎn)賬");
? ? ? ? ? ? System.out.println("5、修改密碼");
? ? ? ? ? ? System.out.println("6、退出");
? ? ? ? ? ? System.out.println("7、注銷賬戶");
? ? ? ? ? ? System.out.println("請您輸入操作命令:");
? ? ? ? ? ? int command = sc.nextInt();
? ? ? ? ? ? switch (command) {
? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? ? ? // 查詢賬戶
? ? ? ? ? ? ? ? ? ? showAccount(acc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? ? ? // 存款
? ? ? ? ? ? ? ? ? ? depositMoney(acc, sc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? case 3:
? ? ? ? ? ? ? ? ? ? // 取款
? ? ? ? ? ? ? ? ? ? drawMoney(acc,sc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? case 4:
? ? ? ? ? ? ? ? ? ? // 轉(zhuǎn)賬
? ? ? ? ? ? ? ? ? ? transferMoney(accounts, acc , sc);
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? case 5:
? ? ? ? ? ? ? ? ? ? // 修改密碼
? ? ? ? ? ? ? ? ? ? updatePassWord(acc,sc);
? ? ? ? ? ? ? ? ? ? return; // 結(jié)束當(dāng)前操作的方法
? ? ? ? ? ? ? ? case 6:
? ? ? ? ? ? ? ? ? ? // 退出
? ? ? ? ? ? ? ? ? ? System.out.println("歡迎下次光臨!!");
? ? ? ? ? ? ? ? ? ? return; // 結(jié)束當(dāng)前操作的方法!
? ? ? ? ? ? ? ? case 7:
? ? ? ? ? ? ? ? ? ? // 注銷賬戶
? ? ? ? ? ? ? ? ? ? // 從當(dāng)前集合中抹掉當(dāng)前賬戶對象即可
? ? ? ? ? ? ? ? ? ? accounts.remove(acc);
? ? ? ? ? ? ? ? ? ? System.out.println("銷戶成功了??!");
? ? ? ? ? ? ? ? ? ? return;// 結(jié)束當(dāng)前操作的方法!
? ? ? ? ? ? ? ? default:
? ? ? ? ? ? ? ? ? ? System.out.println("您的命令輸入有誤~~~");
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? private static void showAccount(Account acc) {
? ? ? ? System.out.println("==================當(dāng)前賬戶詳情===================");
? ? ? ? System.out.println("卡號:" + acc.getCardId());
? ? ? ? System.out.println("姓名:" + acc.getUserName());
? ? ? ? System.out.println("余額:" + acc.getMoney());
? ? ? ? System.out.println("當(dāng)次限額:" + acc.getQuoteMoney());
? ? }
// ? ? ? ? ? ?存款就是拿到當(dāng)前賬戶對象。
//
// ? ? ? ? ? ?然后讓用戶輸入存款的金額。
//
// ? ? ? ? ? ?調(diào)用賬戶對象的setMoney方法將賬戶余額修改成存錢后的余額。
//
// ? ? ? ? ? ?存錢后需要查詢一下賬戶信息,確認(rèn)是否存錢成功了!
? ? private static void depositMoney(Account acc, Scanner sc) {
? ? ? ? System.out.println("==================存錢操作===================");
? ? ? ? System.out.println("請您輸入存款的金額:");
? ? ? ? double money = sc.nextDouble();

? ? ? ? // 直接把金額修改到賬戶對象的money屬性中去
? ? ? ? acc.setMoney(acc.getMoney() + money);
? ? ? ? System.out.println("存款完成?。?);
? ? ? ? showAccount(acc);
? ? }
// ? ? ? ? ? ?取款需要先判斷賬戶是否有錢。
//
// ? ? ? ? ? ?有錢則拿到自己賬戶對象。
//
// ? ? ? ? ? ?然后讓用戶輸入取款金額
//
// ? ? ? ? ? ?判斷取款金額是否超過了當(dāng)次限額,以及余額是否足夠
//
// ? ? ? ? ? ?滿足要求則調(diào)用賬戶對象的setMoney方法完成金額的修改。
? ? private static void drawMoney(Account acc, Scanner sc) {
? ? ? ? System.out.println("==================取款操作===================");
? ? ? ? // 1、判斷它的賬戶是否足夠100元
? ? ? ? if(acc.getMoney() >= 100){
? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? System.out.println("請您輸入取款的金額:");
? ? ? ? ? ? ? ? double money = sc.nextDouble();
? ? ? ? ? ? ? ? // 2、判斷這個金額有沒有超過當(dāng)次限額
? ? ? ? ? ? ? ? if(money > acc.getQuoteMoney()){
? ? ? ? ? ? ? ? ? ? System.out.println("您當(dāng)次取款金額超過每次限額,不要取那么多,每次最多可以?。? + acc.getQuoteMoney());
? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? // 3、判斷當(dāng)前余額是否足夠你取錢
? ? ? ? ? ? ? ? ? ? if(acc.getMoney() >= money){
? ? ? ? ? ? ? ? ? ? ? ? // 夠錢,可以取錢了
? ? ? ? ? ? ? ? ? ? ? ? acc.setMoney(acc.getMoney() - money);
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("恭喜您,取錢" + money + "成功了!當(dāng)前賬戶還剩余:" + acc.getMoney());
? ? ? ? ? ? ? ? ? ? ? ? return;// 取錢后干掉取錢方法
? ? ? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("余額不足??!");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }else {
? ? ? ? ? ? System.out.println("您自己的金額沒有超過100元,就別取了~~~");
? ? ? ? }
? ? }
// ? ? ? ? ? ?轉(zhuǎn)賬功能需要判斷系統(tǒng)中是否有2個賬戶對象及以上。
//
// ? ? ? ? ? ?同時還要判斷自己賬戶是否有錢。
//
// ? ? ? ? ? ?接下來需要輸入對方卡號,判斷對方賬戶是否存在。
//
// ? ? ? ? ? ?對方賬戶存在還需要認(rèn)證對方戶主的姓氏。
//
// ? ? ? ? ? ?滿足要求則可以把自己賬戶對象的金額修改到對方賬戶對象中去。
? ? private static void transferMoney(ArrayList<Account> accounts, Account acc, Scanner sc) {
? ? ? ? // 1、判斷系統(tǒng)中是否有2個賬戶及以上
? ? ? ? if(accounts.size() < 2){
? ? ? ? ? ? System.out.println("對不起,系統(tǒng)中無其他賬戶,您不可以轉(zhuǎn)賬!");
? ? ? ? ? ? return;
? ? ? ? }

? ? ? ? // 2、判斷自己的賬戶對象中是否有錢
? ? ? ? if(acc.getMoney() == 0){
? ? ? ? ? ? System.out.println("對不起,您自己都沒錢,就別轉(zhuǎn)了~~");
? ? ? ? ? ? return;
? ? ? ? }

? ? ? ? // 3、開始轉(zhuǎn)賬邏輯
? ? ? ? while (true) {
? ? ? ? ? ? System.out.println("請您輸入對方賬戶的卡號:");
? ? ? ? ? ? String cardId = sc.next();
? ? ? ? ? ? Account account = getAccountByCardId(cardId , accounts);
? ? ? ? ? ? // 判斷這個賬戶對象是否存在,存在說明對方卡號輸入正確
? ? ? ? ? ? if(account != null){
? ? ? ? ? ? ? ? // 判斷這個賬戶對象是否是當(dāng)前登錄的賬戶自己
? ? ? ? ? ? ? ? if(account.getCardId().equals(acc.getCardId())){
? ? ? ? ? ? ? ? ? ? // 正在給自己轉(zhuǎn)賬
? ? ? ? ? ? ? ? ? ? System.out.println("您不可以為自己轉(zhuǎn)賬!");
? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? // 確認(rèn)對方的姓氏
? ? ? ? ? ? ? ? ? ? String name = "*" + account.getUserName().substring(1);
? ? ? ? ? ? ? ? ? ? System.out.print("請您確認(rèn)【" + name + "】的姓氏:");
? ? ? ? ? ? ? ? ? ? String preName = sc.next(); // 王
? ? ? ? ? ? ? ? ? ? if(account.getUserName().startsWith(preName)){
? ? ? ? ? ? ? ? ? ? ? ? // 真正開始轉(zhuǎn)賬了
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請您輸入轉(zhuǎn)賬的金額:");
? ? ? ? ? ? ? ? ? ? ? ? double money = sc.nextDouble();
? ? ? ? ? ? ? ? ? ? ? ? // 判斷這個金額是否超過了自己的余額
? ? ? ? ? ? ? ? ? ? ? ? if(money > acc.getMoney() ){
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對不起,您要轉(zhuǎn)賬的金額太多,您最多可以轉(zhuǎn)賬多少:" + acc.getMoney());
? ? ? ? ? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? // 真的可以轉(zhuǎn)了
? ? ? ? ? ? ? ? ? ? ? ? ? ? acc.setMoney(acc.getMoney() - money);
? ? ? ? ? ? ? ? ? ? ? ? ? ? account.setMoney(account.getMoney() + money);
? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("恭喜您,轉(zhuǎn)賬成功了,已經(jīng)為" + account.getUserName() +"轉(zhuǎn)賬多少:" + money);
? ? ? ? ? ? ? ? ? ? ? ? ? ? showAccount(acc);
? ? ? ? ? ? ? ? ? ? ? ? ? ? return;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("對不起,您認(rèn)證的信息有誤~~~");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? System.out.println("對不起,您輸入的轉(zhuǎn)賬卡號有問題!");
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? private static void updatePassWord(Account acc, Scanner sc) {
? ? ? ? System.out.println("===========修改密碼=======================");
? ? ? ? while (true) {
? ? ? ? ? ? System.out.println("請您輸入正確的密碼:");
? ? ? ? ? ? String okPassWord = sc.next();
? ? ? ? ? ? // 判斷密碼是否正確
? ? ? ? ? ? if(acc.getPassword().equals(okPassWord)){
? ? ? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? ? ? // 可以輸入新密碼
? ? ? ? ? ? ? ? ? ? System.out.println("請您輸入新的密碼:");
? ? ? ? ? ? ? ? ? ? String newPassWord = sc.next();

? ? ? ? ? ? ? ? ? ? System.out.println("請您輸入確認(rèn)密碼:");
? ? ? ? ? ? ? ? ? ? String okNewPassWord = sc.next();

? ? ? ? ? ? ? ? ? ? if(newPassWord.equals(okNewPassWord)) {
? ? ? ? ? ? ? ? ? ? ? ? // 修改賬戶對象的密碼為新密碼
? ? ? ? ? ? ? ? ? ? ? ? acc.setPassword(newPassWord);
? ? ? ? ? ? ? ? ? ? ? ? return; // 直接結(jié)束掉??!
? ? ? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("您兩次輸入的密碼不一致~~");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }

? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? System.out.println("當(dāng)前輸入的密碼不正確~~~");
? ? ? ? ? ? }
? ? ? ? }

? ? }
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 靜態(tài)方法中調(diào)用Spring注入過程解析

    靜態(tài)方法中調(diào)用Spring注入過程解析

    這篇文章主要介紹了靜態(tài)方法中調(diào)用Spring注入過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2019-11-11
  • Java動態(tài)線程池插件dynamic-tp集成過程淺析

    Java動態(tài)線程池插件dynamic-tp集成過程淺析

    這篇文章主要介紹了Java動態(tài)線程池插件dynamic-tp集成過程,dynamic-tp是一個輕量級的動態(tài)線程池插件,它是一個基于配置中心的動態(tài)線程池,線程池的參數(shù)可以通過配置中心配置進(jìn)行動態(tài)的修改
    2023-03-03
  • Java實(shí)現(xiàn)象棋算法的示例代碼

    Java實(shí)現(xiàn)象棋算法的示例代碼

    象棋算法包括搜索算法、評估函數(shù)和剪枝算法,本文主要介紹了Java實(shí)現(xiàn)象棋算法的示例代碼,具有一定的參考價值,感興趣的可以了解一下
    2023-12-12
  • MyBatis之foreach標(biāo)簽的用法及多種循環(huán)問題

    MyBatis之foreach標(biāo)簽的用法及多種循環(huán)問題

    這篇文章主要介紹了MyBatis之foreach標(biāo)簽的用法及多種循環(huán)問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • Java設(shè)計(jì)模式之適配器模式的示例詳解

    Java設(shè)計(jì)模式之適配器模式的示例詳解

    適配器模式,即將某個類的接口轉(zhuǎn)換成客戶端期望的另一個接口的表示,主要目的是實(shí)現(xiàn)兼容性,讓原本因?yàn)榻涌诓黄ヅ?,沒辦法一起工作的兩個類,可以協(xié)同工作。本文將通過示例詳細(xì)介紹適配器模式,需要的可以參考一下
    2022-08-08
  • Spring執(zhí)行sql腳本文件的方法

    Spring執(zhí)行sql腳本文件的方法

    這篇文章主要介紹了Spring執(zhí)行sql腳本文件的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-03-03
  • 帶你輕松搞定Java面向?qū)ο蟮木幊?-數(shù)組,集合框架

    帶你輕松搞定Java面向?qū)ο蟮木幊?-數(shù)組,集合框架

    Java是面向?qū)ο蟮母呒壘幊陶Z言,類和對象是 Java程序的構(gòu)成核心。圍繞著Java類和Java對象,有三大基本特性:封裝是Java 類的編寫規(guī)范、繼承是類與類之間聯(lián)系的一種形式、而多態(tài)為系統(tǒng)組件或模塊之間解耦提供了解決方案
    2021-06-06
  • Java如何使用HTTPclient訪問url獲得數(shù)據(jù)

    Java如何使用HTTPclient訪問url獲得數(shù)據(jù)

    這篇文章主要介紹了Java使用HTTPclient訪問url獲得數(shù)據(jù)的操作,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • Eclipse創(chuàng)建JavaWeb工程的完整步驟記錄

    Eclipse創(chuàng)建JavaWeb工程的完整步驟記錄

    很多新手不知道Eclipse怎么創(chuàng)建Java Web項(xiàng)目,一起來看看吧,這篇文章主要給大家介紹了關(guān)于Eclipse創(chuàng)建JavaWeb工程的完整步驟,需要的朋友可以參考下
    2023-10-10
  • 深入解析Spring中的@Bean注解

    深入解析Spring中的@Bean注解

    這篇文章主要介紹了深入解析Spring中的@Bean注解,Spring的@Bean注解用于告訴方法,產(chǎn)生一個Bean對象,然后這個Bean對象交給Spring管理,產(chǎn)生這個Bean對象的方法Spring只會調(diào)用一次,隨后這個Spring將會將這個Bean對象放在自己的IOC容器中,需要的朋友可以參考下
    2023-07-07

最新評論