📄 completethecall.java
字号:
import javax.swing.*;
public class CompleteTheCall
{
public static void main(String[] args)
{
String s1;
double firstnum, secnum;
s1 = JOptionPane.showInputDialog("Enter a number:");
firstnum = Double.parseDouble(s1);
s1 = JOptionPane.showInputDialog("Great! Please enter a second number:");
secnum = Double.parseDouble(s1);
findMaximum(firstnum, secnum); // the method is called here
System.exit(0);
} // end of main() method
// following is the findMaximum() method
public static void findMaximum(double x, double y)
{ // start of method body
double maxnum; // variable declaration
if (x >= y) // find the maximum number
maxnum = x;
else
maxnum = y;
JOptionPane.showMessageDialog(null,
"The maximum of " + x + " and " + y + " is " + maxnum,
"Maximum Value", JOptionPane.INFORMATION_MESSAGE);
} // end of method body and end of method
} // end of class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -