Check whether the input is in uppercase or in lowercase or a digit

The following program checks the input whether it is in upper case or in lower case or a digit. The program is implemented using  java.

Code :


import java.util.Scanner;
class checking
{
 public static void main(String []args)
 {
  String str;
  Scanner s=new Scanner(System.in);
  str=s.next();
  char c=str.charAt(0);
  if(c>=65 && c<=90)
   System.out.println("Uppercase");
  else if(c>65)
   System.out.println("Lowercase");
  else 
   System.out.println("Digit");

 }
}

Output :


Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Bit Stuffing Code Implementation in Java

Hackerrank Modified Kaprekar Numbers Solution