📄 arrangevalue.txt
字号:
// Program to read in values for two variables and store the
// larger value in largerValue and the smaller in smallerValue
import javax.swing.JOptionPane;
public class ArrangeValues
{
public static void largeSmall()
{
int largerValue, smallerValue;
String numStr;
// Get the numbers
numStr = JOptionPane.showInputDialog(
"First Integer?: ");
largerValue = Integer.parseInt(numStr);
numStr = JOptionPane.showInputDialog(
"Second Integer?: ");
smallerValue = Integer.parseInt(numStr);
if (largerValue > smallerValue)
JOptionPane.showMessageDialog(null,
"Values were already in correct variables");
else //swap them round
{
int temp;
temp = largerValue;
largerValue = smallerValue;
smallerValue = temp;
JOptionPane.showMessageDialog(null,
"Values have been moved into correct variables");
}
}
public static void main(String[] args)
{
largeSmall();
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -