comparison.java

来自「北京邮电大学牛导的 JAVA课件课件及相关资料」· Java 代码 · 共 31 行

JAVA
31
字号
import javax.swing.JOptionPane;public class Comparison {        /** Creates a new instance of Comparison */    public Comparison() {    }        /**     * @param args the command line arguments     */    public static void main(String[] args) {        String firstnumber, lastnumber;        int first, last;        firstnumber = JOptionPane.showInputDialog("Enter the first number");        lastnumber = JOptionPane.showInputDialog("Enter the last number");        first = Integer.parseInt(firstnumber);        last = Integer.parseInt(lastnumber);        if(first == last)            JOptionPane.showMessageDialog(null,firstnumber+" == "+lastnumber,"Comparison Result",JOptionPane.PLAIN_MESSAGE);        else if (first > last)            JOptionPane.showMessageDialog(null,firstnumber+" > "+lastnumber,"Comparison Result",JOptionPane.PLAIN_MESSAGE);        else if (first < last)            JOptionPane.showMessageDialog(null,firstnumber+" < "+lastnumber,"Comparison Result",JOptionPane.PLAIN_MESSAGE);        System.exit(0);                                }    }

⌨️ 快捷键说明

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