1//Single line
2System.out.println("Hello world"/*+"This is code commented out inline."*/); //You can also put comments at the end
3/*
4Multi
5Line
6comment
7*/
1/**
2* Returns an Image object that can then be painted on the screen.
3* The url argument must specify an absolute <a href="#{@link}">{@link URL}</a>. The name
4* argument is a specifier that is relative to the url argument.
5* <p>
6* This method always returns immediately, whether or not the
7* image exists. When this applet attempts to draw the image on
8* the screen, the data will be loaded. The graphics primitives
9* that draw the image will incrementally paint on the screen.
10*
11* @param url an absolute URL giving the base location of the image
12* @param name the location of the image, relative to the url argument
13* @return the image at the specified URL
14* @see Image
15*/
16public Image getImage(URL url, String name) {
17try {
18return getImage(new URL(url, name));
19} catch (MalformedURLException e) {
20return null;
21}
22}
1// single line comment example
2// integer variable 'a' is assigned value 5
3int a = 5;
4
5/*
6This is
7an example for
8java multiline comment
9*/
10
11// Documentation comments example
12/**
13* <h1>Area of Square</h1>
14* Area of Square java program calculates area
15* using given side value and prints the area.
16* <p>
17* <b>Note: Adding comments in a java program makes it more
18* user friendly and is presumed as good quality code
19*
20* @author Sachin
21* @version 1.0
22* @since 2015-04-12
23* </b>
24* </p>
25*/