Java Blog

 
 
 
 public class JAVA_017
 {

    public static void main(String[] args)
    {
       char Symbol=\'\\0\';

       Symbol=(char)(Math.random( )*128);

       if(Symbol>=\'A\')
       {
          if(Symbol<=\'Z\')
             System.out.println(\"The Random Character Generated is a Capital Letter : \"+Symbol);

          else if(Symbol>=\'a\')
          {
             if(Symbol<=\'z\')
                System.out.println(\"The Random Character Generated is a Small Letter : \"+Symbol);

             else
                System.out.println(\"The Random Character Generated is a greater than \'a\' but it\'s not a letter\");
          }

          else
             System.out.println(\"The Random Character Generated is a less than \'a\' but it\'s not a letter\");
       }

       else
          System.out.println(\"The Random Character Generated is a less than \'A\' but it\'s not a letter\");
    }
 }

 
 
Didn't find what you were looking for? Find more on Program to show the use of Nested If-Else Statements