Created
December 1, 2015 18:32
-
-
Save jukbot/b494d8eb562b575cd825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ASCIItable | |
{ | |
public static void main(String[] args) { | |
final char EXCLAIM = '!'; | |
final char TILDE = '~'; | |
char c = (char) 0; | |
int row =0; | |
while( c <= TILDE) { | |
System.out.printf("%4d", row++); | |
for(int i =0; i < 10; i++) { | |
if(c >= EXCLAIM && c <= TILDE) { | |
System.out.printf("%4d", c); | |
} | |
else | |
{ | |
System.out.printf("%4ds", ""); | |
} | |
c = (char) (c+1); | |
} | |
System.out.println(); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment