真的很无语

Leave a comment (4) 作者:braxiu

明明一个可以直接用 if 简单判断的错误为毛要写成这样

 

import java.io.*;

class nota2zException extends Exception
{
    public void printMessage()
    {
        System.out.println("请输入英文字母");
    }
}

class Test
{
    public static void main(String args[])
    {
        try{
            char c1;
            System.out.print("请输入字符: ");
            c1=(char)System.in.read();
            if ((c1>='a' && c1<='z') || (c1>='A' && c1<='Z'))
            {
                System.out.println("你输入是正确的");
            }
            else
            {
                throw new nota2zException();
            }
        }
        catch(nota2zException e)
        {
            e.printMessage();
        }

        catch(IOException e)
        {
            //****!@#$!@#$!@#%!@#$
        }
    }
}

分类:tech | 标签: Java
已经有 4 条评论啦 »
  1. kingsize kingsize [ Internet Explorer 7.0 @ Windows XP ]

    呵呵,的确这样。我们不懂得东西实在太多

  2. 小周 小周 [ Google Chrome 14.0.835.163 @ Windows 7 ]

    看不懂,飄過..

  3. 方寸阳光 方寸阳光 [ Google Chrome 15.0.874.121 @ Windows XP ]

    fffff

  4. 90后博客 90后博客 [ Internet Explorer 7.0 @ Windows 7 ]

    沙发 呵呵

打劫!!留下你的评论 »

[ 搜狗云输入法 ] [ 表情 ]