-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharCodeCalcs.java
More file actions
31 lines (27 loc) · 831 Bytes
/
Copy pathCharCodeCalcs.java
File metadata and controls
31 lines (27 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.IOException;
public class CharCodeCalcs {
public static void main(String[] args)
{
char letter1 = 'A';
char letter2 = (char)(letter1+1);
char letter3 = letter2;
System.out.println("Here\'s a sequence of letters: " + letter1 + letter2 +
(++letter3));
System.out.println("Here are the decimal codes for the letters:\n" +
letter1 + ": " + (int)letter1 +
" " + letter2 + ": " + (int)letter2 +
" " + letter3 + ": " + (int)letter3);
System.out.println("Here are the hexadecimal codes for the letters:\n"+
letter1 + ": " + Integer.toHexString(letter1) +
" " + letter2 + ": " + Integer.toHexString(letter2) +
" " + letter3 + ": " + Integer.toHexString(letter3));
try
{
System.in.read();
}
catch (IOException e)
{
return;
}
}
}