Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Einzelzeichen {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         System.out.print("Bitte geben Sie ein Symbol ein: ");
  8.         String line = scanner.nextLine();
  9.         char c = line.charAt(0);
  10.         int asciWert = (int) c;
  11.        
  12.         if ((c >= 65) && (c <= 90))
  13.         {
  14.             System.out.println("Großbuchstabe");
  15.         }
  16.         if (((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102)) || ((c >= 65) && (c <= 70)))
  17.         {
  18.             System.out.println("Hexadezimale Ziffer");
  19.         }
  20.         if (c == 48 || c == 49)
  21.         {
  22.             System.out.println("binäre Ziffer");
  23.         }
  24.         if ((c >= 48) && (c <= 55))
  25.         {
  26.             System.out.println("oktale Ziffer");
  27.         }
  28.         if (!(((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 90)) || ((c >= 97) && (c <= 102))))
  29.         {
  30.             System.out.println("Unbekannt");
  31.         }
  32.         scanner.close();
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement