⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectdiskmaker.java

📁 《A first book of java》by Gary J.Bronson 北大出版社
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -