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

📄 lettercheck.java

📁 Java Classic Examples是我买的两本书:《JAVA经典实例》和《java入门经典源代码》里边附送光盘里带的源码
💻 JAVA
字号:
public class LetterCheck
{
   public static void main(String args[]) 
   {
      char symbol = 'A';
      symbol = (char)(128.0*Math.random());        // Generate a random character

      if(symbol >= 'A')                            // Is it A or greater?
      {
         if(symbol <= 'Z')                         // yes, so is it Z or less?
            // Then it is a capital letter
            System.out.println("You have the capital letter " + symbol);
         else                                      // It is not Z or less
            if(symbol >= 'a')                      // So is it a or greater?
               if(symbol <= 'z')                   // Yes, so is it z or less?
                  // Then it is a small letter
                  System.out.println("You have the small letter " + symbol);
               else                                // It is not less than z
                  System.out.println(
                            "The code is greater than a but it's not a letter");
            else
               System.out.println(
                            "The code is less than a and its not a letter");
       }
       else
          System.out.println("The code is less than A so it's not a letter");
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -