Java判断输入字符,是a-z还是A-Z或者是数字

import java.util.Scanner;
public class demo01 {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	System.out.println("请输入:");
	Scanner input = new Scanner(System.in);
	
	int a = input.next().charAt(0);
	
	if(a>0||a<0)
	{
		System.out.println("你输入的是数字!");
	}else if(a>='A'&&a<='Z')
	{
		System.out.println("您输入了大写字母!");
	}else if(a>'a'&&a<'z')
	{
		System.out.println("您输入了小写字母!");
	}
	else 
	{
		System.out.println("您输入有误!!!");
	}
	
	input.close();
	
	
	
}

}

你可能感兴趣的:(Java编程,Java编程)