write Java statements to find if a character variable called var
contains alphabet or not
Answers
Answered by
8
Answer:
import java.util.Scanner;
public class Alphabet {
public static void main(String[] args) {
Scanner input = new scanner(System.in);
char var ;
System.outp.print("Enter A Charecter: ");
var = input.nextChar();
if( (var >= 'a' && var <= 'z') || (var >= 'A' && var <= 'Z'))
System.out.println(var + " is an alphabet.");
else
System.out.println(var + " is not an alphabet.");
}
}
// Hope You Find It Useful :-)
Similar questions