Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class CharOrNumber {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- char ch;
- System.out.println("Enter your character:");
- ch = in.next().charAt(0);
- System.out.println((ch >= '0' && ch <= '9') ? "This is a number" : "This is not a number");
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment