1.应用 System.out.printf()的方法进行格式化输出
%s c d f b 等
2.应用Scanner类进行输入
import java.util.Scanner;
Scanner input=new Scanner(System.in);
int firstNumber=input.nextInt(); //接受第一个整数
3,利用对话框进行输入和输出
import javax.swing.JOptionPane;
String firstNumber=JOptionPane.showInputDialog("请输入第一个数");
number1=Integer.parseInt(firstNumber);
JOptionPane.showMessageDialog(null,"结果是"+sub,"结果",JOptionPane.PLAIN_MESSAGE);
System.exit(0);