Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Einzelzeichen {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.print("Bitte geben Sie ein Symbol ein: ");
- String line = scanner.nextLine();
- char c = line.charAt(0);
- int asciWert = (int) c;
- if ((c >= 65) && (c <= 90))
- {
- System.out.println("Großbuchstabe");
- }
- if (((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102)) || ((c >= 65) && (c <= 70)))
- {
- System.out.println("Hexadezimale Ziffer");
- }
- if (c == 48 || c == 49)
- {
- System.out.println("binäre Ziffer");
- }
- if ((c >= 48) && (c <= 55))
- {
- System.out.println("oktale Ziffer");
- }
- if (!(((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 90)) || ((c >= 97) && (c <= 102))))
- {
- System.out.println("Unbekannt");
- }
- scanner.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement