Template:Java Code File/doc

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Optimized version of the code template, specialized for Java Programming examples.

Usage[edit source]

Based around Template:code, but with a few of the defaults changed so it's optimised for the purpose of Java examples, all that's really needed is the title and code:

{{Java_Code_File
| header=JavaExample.java
| source=
Class JavaExample {
    public static void main(String[] args)
    {
        System.out.println("Hello, World!");
    }
}
}}

This will look like this:

JavaExample.java
Class JavaExample {
    public static void main(String[] args)
    {
        System.out.println("Hello, World!");
    }
}
Copy friendly
Class JavaExample {
    public static void main(String[] args)
    {
        System.out.println("Hello, World!");
    }
}