Print ASCII characters in Java

 

The full form of ASCII is The American Standard Code for Information Interchange. The ASCII code includes only control characters like A-Z , a-z,special characters(>?<) etc. Computer do not understand anything(like characters) other than numbers(bits or bytes).

 

Example…

class DoWhileEx

{

public static void main(String aa[])

{

char ch;

int x=30;

do

{

ch=(char)x;

System.out.print(ch+" ");

if(x%25==0)

System.out.println();

x++;

}

while(x<=255);

}

}

Explanation…

In this example we use do-while loop….

The working of do-while loop is the same as while loop except in the fact that the condition is checked at the end of the loop. So the do-while loop is also called as the Exit Controlled loop. The effect of this checking is that even if the condition is not fulfilled, the statements in the body of the loop will be executed at least once. So the minimum number of times a do-while loop runs is 1.

In while loop, the test condition is checked in the beginning of the loop, but in do-while, the test condition is checked at the end of the loop.

ASCII CODES 30 to 255

OUTPUT....

ASCII codes