Display the ASCII character table

The problem

Write a program that prints the characters in the ASCII character table from ! to ~. Display ten characters per line. The ASCII table is viewable at ascii table. Be sure to seperate characters are separated by exactly one space.

Breaking it down

Using IntStream.rangeClosed which will create a range of chars between ! and ~ we can loop over outputting the value. Since i is an int it will need to be converted to a char using Character.toString.

public static void main(String[] args) {

    IntStream.rangeClosed('!', '~').forEach(i -> {
        System.out.println(Character.toString((char) i));
    });
}

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 { | } ~