Prettify code

Load the javascript:

<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=java"></script>

Process the program:

<pre class="prettyprint">
// simple program (with ArrayList to confuse things)
import java.util.ArrayList;

class Hello {
    public static void main(String[] args) {
	ArrayList<String> list = new ArrayList<>();
	System.out.println("Hello, world!");
    }
}
</pre>

Results

// simple program (with ArrayList to confuse things)
import java.util.ArrayList;

class Hello {
    public static void main(String[] args) {
	ArrayList list = new ArrayList<>();
	System.out.println("Hello, world!");
    }
}

Still have problem with escaping ArrayList notation.

Reference home page


Maintained by John Loomis, last updated 28 January 2020