java圖形化界面實(shí)現(xiàn)簡(jiǎn)單混合運(yùn)算計(jì)算器的示例代碼
寫了好幾天了終于寫完了這個(gè)四則運(yùn)算計(jì)算器,總代碼放在后面
截圖如下:

首先是布局都比較簡(jiǎn)單,最上面的一個(gè)框是總的輸出框,
第二個(gè)框是每次輸入的數(shù)字顯示在框內(nèi),
對(duì)于每一個(gè)按鈕都增加監(jiān)聽(tīng)器,
對(duì)于數(shù)字按鈕:當(dāng)長(zhǎng)度大于8的 或者等號(hào)已經(jīng)出現(xiàn)之后就不再處理按鈕事件
if(e.getSource().equals(button1)) {
s=numberText.getText();
//數(shù)字長(zhǎng)度大于8或者等號(hào)已出現(xiàn)
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("1");
}else {
numberText.setText(s + "1");
}
}
其余的按鈕都差不多。
當(dāng)按鈕為小數(shù)點(diǎn)時(shí),長(zhǎng)度大于7就不再處理,因?yàn)榭偟拈L(zhǎng)度不能超過(guò)8,而小數(shù)點(diǎn)后面還要與數(shù)字,
同時(shí)標(biāo)記小數(shù)點(diǎn)已經(jīng)出現(xiàn)過(guò),因?yàn)橐粋€(gè)數(shù)中最多出現(xiàn)一個(gè)小數(shù)點(diǎn)
//當(dāng)按鈕為小數(shù)點(diǎn)時(shí)
if(e.getSource().equals(buttonpoint)) {
s=numberText.getText();
if(s.length()>7 || equalbook == 1) {
}
if(pointbook==0) {
numberText.setText(s + ".");
pointbook = 1;
}
}
當(dāng)按鈕為加號(hào)時(shí):
當(dāng)數(shù)字輸入框?yàn)榭諘r(shí)不做處理

也有可能是最后一位是小數(shù)點(diǎn),當(dāng)然也不處理

當(dāng)最上方的輸出框的最后一位是右括號(hào)的時(shí)候,可以用加號(hào)

//當(dāng)按鈕為加號(hào)時(shí)
if(e.getSource().equals(buttonadd)) {
s=numberText.getText();
char ch1[] = s.toCharArray();
int length1 = s.length() - 1;
String S = expressText.getText();
char ch2[] = S.toCharArray();
int length2 = S.length() - 1;
//當(dāng)數(shù)字為空或?yàn)?或數(shù)字的最后一位是小數(shù)點(diǎn)時(shí)不作處理
if((length2 == -1 ||ch2[length2] != ')') && (s.equals("0") || s.equals("") || ch1[length1] == '.')) {
}else {
numberText.setText("");
expressText.setText(expressText.getText() + s + "+");
}
}
+, -, *, /都差不多
當(dāng)前面是運(yùn)算符或者左括號(hào)的時(shí)候才能用左括號(hào), 注意當(dāng)框內(nèi)無(wú)元素的時(shí)候也可以加左括號(hào), 但是需要判斷元素的個(gè)數(shù)是否大于0
if(e.getSource().equals(buttonleft)) {
if(!numberText.getText().equals("0") && !numberText.getText().contentEquals("")) {
expressText.setText(expressText.getText() + numberText.getText());
}
s=expressText.getText();
char ch[] = s.toCharArray();
int length = s.length() - 1;
/*
* 當(dāng)前面是運(yùn)算符或者左括號(hào)的時(shí)候才能用左括號(hào)
* 注意當(dāng)框內(nèi)無(wú)元素的時(shí)候也可以加左括號(hào)
* 但是需要判斷元素的個(gè)數(shù)是否大于0
*/
if(length == -1 || ch[length] == '+' || ch[length] == '-' ||
ch[length] == '*' || ch[length] == '/' ||
ch[length] == '(' || s.equals("")) {
expressText.setText(expressText.getText() + '(');
leftNum++;
}
}
右括號(hào)就不一樣
if(e.getSource().equals(buttonright)) {
if(!numberText.getText().equals("0")) {
expressText.setText(expressText.getText() + numberText.getText());
numberText.setText("");
}
s=expressText.getText();
char ch[] = s.toCharArray();
int length = s.length() - 1;
/*
* 只有前面是數(shù)字的時(shí)候且左括
* 號(hào)的數(shù)量大于右括號(hào)的數(shù)量的時(shí)候才能加右括號(hào)
*/
if(Character.isDigit(ch[length]) && leftNum > rightNum) {
rightNum++;
expressText.setText(expressText.getText() + ')');
}
}
當(dāng)按鈕為 C時(shí),清除所有內(nèi)容并更新等號(hào)狀態(tài), 左括號(hào)數(shù)量, 右括號(hào)數(shù)量, 小數(shù)點(diǎn)狀態(tài),當(dāng)一次計(jì)算完成之后,只有按C按鈕才能進(jìn)行新的計(jì)算。
當(dāng)按鈕為CE時(shí),只清除數(shù)字框中的內(nèi)容。
if(e.getSource().equals(buttonC)) {
numberText.setText("0");
expressText.setText("");
leftNum = 0;
rightNum = 0;
pointbook = 0;
equalbook = 0;
}
當(dāng)按鈕為等號(hào)時(shí)就把總輸出框中顯示的字符串取出進(jìn)行計(jì)算,因?yàn)檫@個(gè)計(jì)算器是帶括號(hào)的,所以這里我用了逆波蘭表達(dá)式做的,需要把中綴表達(dá)式變?yōu)楹缶Y表達(dá)式,然后進(jìn)行計(jì)算,這一點(diǎn)我認(rèn)為是最困難的一點(diǎn),后面有時(shí)間我會(huì)再寫關(guān)于 逆波蘭表達(dá)式實(shí)現(xiàn)以及 逆波蘭表達(dá)式的求值。
需要注意588行的代碼,最后的兩個(gè)括號(hào)的條件沒(méi)有加上,導(dǎo)致花了周末一天在找bug......
else if((ch[j] == '*' || ch[j] == '/') &&
(operater1=='+' || operater1=='-') ||
(operater1=='(' || operater1 == ')')) {
Operater.push(ch[j]);
break;
}
所有代碼:
package cn.edu.shengda;
/*
* author 201705050153 張宜強(qiáng)
*/
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Stack;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Calculator extends JFrame implements ActionListener {
Calculator() {
init();
}
public void init() {
JFrame frame = new JFrame ("計(jì)算器");
frame.setBackground(Color.yellow);
frame.setLayout(null);
//放置數(shù)字0
button0 = new JButton("0");
button0.setBounds(20, 200, 100, 25);
frame.add(button0);
//放置數(shù)字1
button1 = new JButton("1");
button1.setBounds(20, 170, 45, 25);
frame.add(button1);
//放置數(shù)字2
button2 = new JButton("2");
button2.setBounds(75, 170, 45, 25);
frame.add(button2);
//放置數(shù)字3
button3 = new JButton("3");
button3.setBounds(130, 170, 45, 25);
frame.add(button3);
//放置數(shù)字4
button4 = new JButton("4");
button4.setBounds(20, 140, 45, 25);
frame.add(button4);
//放置數(shù)字5
button5 = new JButton("5");
button5.setBounds(75, 140, 45, 25);
frame.add(button5);
//放置數(shù)字6
button6 = new JButton("6");
button6.setBounds(130, 140, 45, 25);
frame.add(button6);
//放置數(shù)字7
button7 = new JButton("7");
button7.setBounds(20, 110, 45, 25);
frame.add(button7);
//放置數(shù)字8
button8 = new JButton("8");
button8.setBounds(75, 110, 45, 25);
frame.add(button8);
//放置數(shù)字9
button9 = new JButton("9");
button9.setBounds(130, 110, 45, 25);
frame.add(button9);
//放置 .
buttonpoint = new JButton(".");
buttonpoint.setBounds(130, 200, 45, 25);
frame.add(buttonpoint);
//放置 +
buttonadd = new JButton("+");
buttonadd.setBounds(185, 200, 45, 25);
frame.add(buttonadd);
//放置 -
buttonreduce = new JButton("-");
buttonreduce.setBounds(185, 170, 45, 25);
frame.add(buttonreduce);
//放置 *
buttonride = new JButton("*");
buttonride.setBounds(185, 140, 45, 25);
frame.add(buttonride);
//放置 /
buttonexcept = new JButton("/");
buttonexcept.setBounds(185, 110, 45, 25);
frame.add(buttonexcept);
//放置 =
buttonequal = new JButton("=");
buttonequal.setBounds(240, 170, 55, 55);
frame.add(buttonequal);
//計(jì)算1/x
buttoninvert = new JButton("1/x");
buttoninvert.setBounds(240, 110, 55, 55);
frame.add(buttoninvert);
//放置左括號(hào)
buttonleft = new JButton("(");
buttonleft.setBounds(20, 80, 45, 25);
frame.add(buttonleft);
//放置右括號(hào)
buttonright = new JButton(")");
buttonright.setBounds(75, 80, 45, 25);
frame.add(buttonright);
//放置C 消除所有輸入
buttonC = new JButton("C");
buttonC.setBounds(130, 80, 75, 25);
frame.add(buttonC);
//放置CE 消除當(dāng)前輸入
buttonCE = new JButton("CE");
buttonCE.setBounds(220, 80, 75, 25);
frame.add(buttonCE);
//添加表達(dá)式文本框
expressText = new JTextField();
expressText.setBounds(20, 10, 300, 30);
frame.add(expressText);
//添加數(shù)字文本框
numberText = new JTextField("0");
numberText.setBounds(20, 40, 300, 30);
frame.add(numberText);
//加監(jiān)聽(tīng)器
button0.addActionListener(this);
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
button5.addActionListener(this);
button6.addActionListener(this);
button7.addActionListener(this);
button8.addActionListener(this);
button9.addActionListener(this);
buttonpoint.addActionListener(this);
buttonadd.addActionListener(this);
buttonreduce.addActionListener(this);
buttonride.addActionListener(this);
buttonexcept.addActionListener(this);
buttoninvert.addActionListener(this);
buttonequal.addActionListener(this);
buttonleft.addActionListener(this);
buttonright.addActionListener(this);
buttonC.addActionListener(this);
buttonCE.addActionListener(this);
numberText.addActionListener(this);
expressText.addActionListener(this);
frame.setBounds(0, 0, 350, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
JButton button0;
JButton button1;
JButton button2;
JButton button3;
JButton button4;
JButton button5;
JButton button6;
JButton button7;
JButton button8;
JButton button9;
JButton buttonpoint;
JButton buttonadd;
JButton buttonreduce;
JButton buttonride;
JButton buttonexcept;
JButton buttonequal;
JButton buttoninvert;
JButton buttonleft;
JButton buttonright;
JButton buttonC;
JButton buttonCE;
JTextField numberText;
JTextField expressText;
String s = null;
//記錄小數(shù)點(diǎn)是否出現(xiàn),每次當(dāng)前數(shù)字框中只能出現(xiàn)一個(gè)小數(shù)點(diǎn)
int pointbook = 0;
//記錄等號(hào)是否出現(xiàn),每次計(jì)算的總算式只能出現(xiàn)一個(gè)等號(hào)
int equalbook = 0;
//記錄左括號(hào)的數(shù)量
int leftNum = 0;
//記錄有括號(hào)的數(shù)量
int rightNum = 0;
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
//當(dāng)按鈕為0時(shí)
if(e.getSource().equals(button0)) {
s=numberText.getText();
if(s.length()>8) {
}
else if(s.equals("0") || equalbook == 1) {
}else {
numberText.setText(s + "0");
}
}
//當(dāng)按鈕為1時(shí)
if(e.getSource().equals(button1)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("1");
}else {
numberText.setText(s + "1");
}
}
//當(dāng)按鈕為2時(shí)
if(e.getSource().equals(button2)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("2");
}else {
numberText.setText(s + "2");
}
}
//當(dāng)按鈕為3時(shí)
if(e.getSource().equals(button3)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("3");
}else {
numberText.setText(s + "3");
}
}
//當(dāng)按鈕為4時(shí)
if(e.getSource().equals(button4)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("4");
}else {
numberText.setText(s + "4");
}
}
//當(dāng)按鈕為5時(shí)
if(e.getSource().equals(button5)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("5");
}else {
numberText.setText(s + "5");
}
}
//當(dāng)按鈕為6時(shí)
if(e.getSource().equals(button6)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("6");
}else {
numberText.setText(s + "6");
}
}
//當(dāng)按鈕為7時(shí)
if(e.getSource().equals(button7)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("7");
}else {
numberText.setText(s + "7");
}
}
//當(dāng)按鈕為3時(shí)
if(e.getSource().equals(button8)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("8");
}else {
numberText.setText(s + "8");
}
}
//當(dāng)按鈕為9時(shí)
if(e.getSource().equals(button9)) {
s=numberText.getText();
if(s.length()>8 || equalbook == 1) {
}
else if(s.equals("0") || s.equals("")) {
numberText.setText("9");
}else {
numberText.setText(s + "9");
}
}
//當(dāng)按鈕為小數(shù)點(diǎn)時(shí)
if(e.getSource().equals(buttonpoint)) {
s=numberText.getText();
if(s.length()>7 || equalbook == 1) {
}
if(pointbook==0) {
numberText.setText(s + ".");
pointbook = 1;
}
}
//當(dāng)按鈕為加號(hào)時(shí)
if(e.getSource().equals(buttonadd)) {
s=numberText.getText();
char ch1[] = s.toCharArray();
int length1 = s.length() - 1;
String S = expressText.getText();
char ch2[] = S.toCharArray();
int length2 = S.length() - 1;
//當(dāng)數(shù)字為空或?yàn)?或數(shù)字的最后一位是小數(shù)點(diǎn)時(shí)不作處理
if((length2 == -1 ||ch2[length2] != ')') && (s.equals("0") || s.equals("") || ch1[length1] == '.')) {
}else {
numberText.setText("");
expressText.setText(expressText.getText() + s + "+");
}
}
//當(dāng)按鈕為減號(hào)時(shí)
if(e.getSource().equals(buttonreduce)) {
s=numberText.getText();
char ch1[] = s.toCharArray();
int length1 = s.length() - 1;
String S = expressText.getText();
char ch2[] = S.toCharArray();
int length2 = S.length() - 1;
if((length2 == -1 ||ch2[length2] != ')') && (s.equals("0") || s.equals("") || ch1[length1]=='.')) {
}else {
numberText.setText("");
expressText.setText(expressText.getText() + s + "-");
}
}
//當(dāng)按鈕為乘號(hào)時(shí)
if(e.getSource().equals(buttonride)) {
s=numberText.getText();
char ch1[] = s.toCharArray();
int length1 = s.length() - 1;
String S = expressText.getText();
char ch2[] = S.toCharArray();
int length2 = S.length() - 1;
if((length2 == -1 ||ch2[length2] != ')') && (s.equals("0") || s.equals("") || ch1[length1]=='.')) {
}else {
numberText.setText("");
expressText.setText(expressText.getText() + s + "*");
}
}
//當(dāng)按鈕為除號(hào)時(shí)
if(e.getSource().equals(buttonexcept)) {
s=numberText.getText();
char ch1[] = s.toCharArray();
int length1 = s.length() - 1;
String S = expressText.getText();
char ch2[] = S.toCharArray();
int length2 = S.length() - 1;
if((length2 == -1 ||ch2[length2] != ')') && (s.equals("0") || s.equals("") || ch1[length1]=='.')) {
}else {
numberText.setText("");
expressText.setText(expressText.getText() + s + "/");
}
}
//當(dāng)按鈕為左括號(hào)時(shí)
if(e.getSource().equals(buttonleft)) {
if(!numberText.getText().equals("0") && !numberText.getText().contentEquals("")) {
expressText.setText(expressText.getText() + numberText.getText());
}
s=expressText.getText();
char ch[] = s.toCharArray();
int length = s.length() - 1;
/*
* 當(dāng)前面是運(yùn)算符或者左括號(hào)的時(shí)候才能用左括號(hào)
* 注意當(dāng)框內(nèi)無(wú)元素的時(shí)候也可以加左括號(hào)
* 但是需要判斷元素的個(gè)數(shù)是否大于0
*/
if(length == -1 || ch[length] == '+' || ch[length] == '-' ||
ch[length] == '*' || ch[length] == '/' ||
ch[length] == '(' || s.equals("")) {
expressText.setText(expressText.getText() + '(');
leftNum++;
}
}
//當(dāng)按鈕為右括號(hào)時(shí)
if(e.getSource().equals(buttonright)) {
if(!numberText.getText().equals("0")) {
expressText.setText(expressText.getText() + numberText.getText());
numberText.setText("");
}
s=expressText.getText();
char ch[] = s.toCharArray();
int length = s.length() - 1;
/*
* 只有前面是數(shù)字的時(shí)候且左括
* 號(hào)的數(shù)量大于右括號(hào)的數(shù)量的時(shí)候才能加右括號(hào)
*/
if(Character.isDigit(ch[length]) && leftNum > rightNum) {
rightNum++;
expressText.setText(expressText.getText() + ')');
}
}
/*
*當(dāng)按鈕為 C時(shí)
*清除所有內(nèi)容
*并更新等號(hào)狀態(tài), 左括號(hào)數(shù)量, 右括號(hào)數(shù)量, 小數(shù)點(diǎn)狀態(tài)
*當(dāng)一次計(jì)算完成之后,只有按CE按鈕才能進(jìn)行新的計(jì)算
*/
if(e.getSource().equals(buttonC)) {
numberText.setText("0");
expressText.setText("");
leftNum = 0;
rightNum = 0;
pointbook = 0;
equalbook = 0;
}
/*
*當(dāng)按鈕為CE時(shí),
*清除當(dāng)前數(shù)字框中內(nèi)容
*更新小數(shù)點(diǎn)狀態(tài)
*/
if(e.getSource().equals(buttonCE)) {
numberText.setText("0");
pointbook = 0;
}
//當(dāng)按鈕為1/x時(shí)把輸入框中的值變?yōu)榈箶?shù)
if(e.getSource().equals(buttoninvert) ) {
s = numberText.getText();
//等于0的時(shí)候不進(jìn)行操作
if(s.equals("0")) {
}else {
double a = Double.parseDouble(numberText.getText());
a = 1/a;
numberText.setText(String.valueOf(a));
}
}
//當(dāng)按鈕為等于號(hào)時(shí)
if(e.getSource().equals(buttonequal)) {
s=numberText.getText();
if(!s.equals("0") && !s.equals("")) {
expressText.setText(expressText.getText() + s);
}
//當(dāng)?shù)忍?hào)沒(méi)有出現(xiàn)時(shí)才能輸入等號(hào)
if(equalbook == 0) {
numberText.setText("");
//補(bǔ)全右括號(hào)
for(int i = 0; i < leftNum - rightNum; i++) {
expressText.setText(expressText.getText() + ')');
}
/*
* 聲明棧
* 一個(gè)char型存儲(chǔ)運(yùn)算符
* 將中綴表達(dá)式轉(zhuǎn)化為逆波蘭表達(dá)式
*/
String[] ansString = new String[100];
int Size = 0;
Stack<Character> Operater = new Stack<Character>();
s = expressText.getText();
char ch[] = s.toCharArray();
int length = ch.length;
for(int j = 0; j < length; j++) {
//當(dāng)數(shù)組元素為數(shù)字時(shí)
if(ch[j] >='0' && ch[j] <= '9') {
double Number = ch[j] - '0';
//繼續(xù)往后遍歷,直到不是數(shù)字和小數(shù)點(diǎn)
//記錄小數(shù)點(diǎn)是否出現(xiàn)
int point = 0;
//記錄小數(shù)點(diǎn)出現(xiàn)后的位數(shù)
int bit = 1;
if(j==length-1) {
ansString[Size++] = String.valueOf(Number);
}
for(j++; j<length; j++) {
if((ch[j] < '0' || ch[j] >'9') && ch[j]!='.') {
j--;
ansString[Size++] = String.valueOf(Number);
break;
}
if(ch[j] == '.') {
point = 1;
continue;
}
if(ch[j] >= '0' && ch[j] <= '9') {
/*
* 當(dāng)小數(shù)點(diǎn)沒(méi)有出現(xiàn)時(shí)和沒(méi)出現(xiàn)時(shí)要分開(kāi)討論
*/
if(point == 0) {
Number = Number * 10 + (ch[j] - '0');
} else {
Number = Number + Math.pow(10, -bit) * (ch[j]-'0');
bit++;
}
}
}
} else { //考慮運(yùn)算符
if(ch[j] =='(') {
Operater.push('(');
} else if(ch[j]==')') {
while(!Operater.peek().equals('(')) {
ansString[Size++] = String.valueOf(Operater.peek());
Operater.pop();
}
Operater.pop();
} else {
if(Operater.empty()) {
Operater.push(ch[j]);
}
else {
//System.out.println("!" + ch[j]);
while(true) {
if(Operater.empty()) {
Operater.push(ch[j]);
break;
}
char operater1 = Operater.peek();
if((ch[j] == '*' || ch[j] == '/') &&
(operater1=='+' || operater1=='-') || (operater1=='(' || operater1 == ')')) {
Operater.push(ch[j]);
break;
}
else {
ansString[Size++] = String.valueOf(Operater.peek());
Operater.pop();
}
}
}
}
}
}//System.out.println(s);
while(!Operater.empty()) {
ansString[Size++] = String.valueOf(Operater.peek());
Operater.pop();
}
// for(int i=0; i<Size; i++)
// System.out.println(ansString[i]);
//最后計(jì)算逆波蘭表達(dá)式的值
Stack<Double> Last = new Stack<Double>();
for(int i=0; i<Size; i++) {
String s1 = ansString[i];
char ch2[] = s1.toCharArray();
if(ch2[0]>='0' && ch2[0]<='9') {
Last.push(Double.parseDouble(s1));
}
else {
double num1 = Last.pop();
double num2 = Last.pop();
double num3 = 0;
if(ch2[0]=='+')
num3 = num2 + num1;
else if(ch2[0]=='-')
num3 = num2 - num1;
else if(ch2[0]=='*')
num3 = num2 * num1;
else if(ch2[0]=='/')
num3 = num2 / num1;
Last.push(num3);
}
}
expressText.setText(expressText.getText() + "=" + Last.pop());
equalbook = 1;
}
}
}
public static void main(String []args) {
Calculator calculator = new Calculator();
}
}
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java多線程局域網(wǎng)聊天室的實(shí)現(xiàn)
在學(xué)習(xí)了一個(gè)學(xué)期的java以后,搞了一個(gè)多線程的聊天室,熟悉了一下服務(wù)器和客戶機(jī)的操作。感興趣的小伙伴們可以參考一下2021-06-06
詳解Spring Boot中PATCH上傳文件的問(wèn)題
這篇文章主要介紹了詳解Spring Boot中PATCH上傳文件的問(wèn)題,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-12-12
Java多線程并發(fā)synchronized?關(guān)鍵字
這篇文章主要介紹了Java多線程并發(fā)synchronized?關(guān)鍵字,Java?在虛擬機(jī)層面提供了?synchronized?關(guān)鍵字供開(kāi)發(fā)者快速實(shí)現(xiàn)互斥同步的重量級(jí)鎖來(lái)保障線程安全。2022-06-06
java使用jacob實(shí)現(xiàn)word轉(zhuǎn)pdf
這篇文章主要為大家詳細(xì)介紹了java使用jacob實(shí)現(xiàn)word轉(zhuǎn)pdf,通過(guò)調(diào)用模板文件,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-12-12
MyBatis #{}和${} |與數(shù)據(jù)庫(kù)連接池使用詳解
本文將為大家說(shuō)說(shuō)關(guān)于 #{} 和 ${},這個(gè)是 MyBatis 在面試中最常問(wèn)的面試題,以及數(shù)據(jù)庫(kù)連接池相關(guān)的知識(shí),感興趣的朋友跟隨小編一起看看吧2024-01-01
java Lombok之@Accessors用法及說(shuō)明
這篇文章主要介紹了java Lombok之@Accessors用法及說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-03-03
詳解Spring Cloud Zuul 服務(wù)網(wǎng)關(guān)
本篇文章主要介紹了詳解Spring Cloud Zuul 服務(wù)網(wǎng)關(guān),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-12-12

