Java char type display the ASCII character table

Question

We would like to write a program that prints the characters in the ASCII character table from ! to ~.

Display ten characters per line.


public class Main {

    public static void main(String[] args) {

        //your code here

    }
}





public class Main {

    public static void main(String[] args) {

        for (int i = '!', count = 1; i <= '~'; i++)
            System.out.print((count++ % 10 != 0) ? (char)i + " " : (char)i + "\n");

    }
}



PreviousNext

Related