selectdiskmaker.java
来自「《A first book of java》by Gary J.Bronson 」· Java 代码 · 共 35 行
JAVA
35 行
import javax.swing.*;
import java.text.*; // needed for formatting
public class SelectDiskMaker
{
public static void main(String[] args)
{
String s1, outMessage;
int code;
s1 =JOptionPane.showInputDialog("Enter a number:");
code = Integer.parseInt(s1);
switch (code)
{
case 1:
outMessage = "3M Corporation";
break;
case 2:
outMessage = "Maxell Corporation";
break;
case 3:
outMessage = "Sony Corporation";
break;
case 4:
outMessage = "Verbatim Corporation";
break;
default:
outMessage = "An invalid code was entered";
} // end of switch
JOptionPane.showMessageDialog(null, outMessage,
"Program 4.6",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
} // end of main()
} // end of class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?