Write a program to print the ASCII values


The program declares a class called Ascii_Values and a main method, which is the entry point of the program. Within the main method, the program runs a for loop from 1 to 255 (inclusive) to cover all ASCII values. Within the loop, the program converts the integer value of each ASCII character to its corresponding character using the (char) type casting operator. The program then prints out the character using the System.out.println() method.

Source Code

class Ascii_Values
{
	public static void main(String[] args)
	{
		for(int s=1;s<=255;s++)
		{
			System.out.println((char)s);	
		}
 
	}
}

Output

☺
☻
♥
♦
♣
♠
♂
♀
♫
☼
►
◄
↕
‼
¶
§
▬
↨
↑
↓
→
←
∟
↔
▲
▼
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
⌂
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
¡
¢
£
?
¥
?
?
?
?
ª
«
¬
?
?
?
°
±
²
?
?
µ
?
·
?
?
º
»
¼
½
?
¿
?
?
?
?
Ä
Å
Æ
Ç
?
É
?
?
?
?
?
?
?
Ñ
?
?
?
?
Ö
?
?
?
?
?
Ü
?
?
ß
à
á
â
?
ä
å
æ
ç
è
é
ê
ë
ì
í
î
ï
?
ñ
ò
ó
ô
?
ö
÷
?
ù
ú
û
ü
?
?
ÿ

Example Programs