Read Articles

Friday, 1 April 2011

Java Comments


When you create a New Project in NetBeans, you'll notice that some text is greyed out, with lots of slashes and asterisks:
The Java coding window
The greyed-out areas are comments. When the programme runs, comments are ignored. So you can type whatever you want inside of your comments. But it's usual to have comments that explain what is you're trying to do. You can have a single line comment by typing two slashes, followed by your comment:
//This is a single line comment
If you want to have more than one line, you can either do this:
//This is a comment spreading
//
over two lines or more
Or you can do this:
/*This is a comment spreading
over two lines or more
*/
In the comment above, note how it starts with /*. To end the comment, we have */ instead.
There's also something called a Javadoc comment. You can see two of these in the coding image on the previous page. A Javadoc comment starts with a single forward slash and two asterisks ( /** ) and ends with an asterisk and one slash ( */ ). Each line of the comment starts with one asterisk:
/**
*
This is a Javadoc comment 
*/
Javadoc comments are used to document code. The documented code can then be turned into an HTML page that will be helpful to others. You can see what these look like by clicking Run from the menu at the top of NetBeans. From the Run menu, select Generate Javadoc. There's not much to see, however, as you haven't written any code yet!
At this stage of your programming career, you can delete the comments that NetBeans generates for you. Here's our code again with the comments deleted:
Coding Window - Java Comments Deleted
In the next part, you'll learn about the structure of the above code, and how to run your programmes.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.

free counters

Categories

Blog File Sharing Troubleshooting all Computer Troubleshooting How to Operating System Internet Maintanance and Repair ERROR Solutions Help Support Help and Support Device Manager Error Computer Windows Device Applications Install Java Script Computer Repair Java Programe Photoshop Add HTML facebook on site Computer Management Facebook and Site Messenger and Chat Protect Your Computer XFBML and HTML Facebook BELAJAR PHOTOSHOP Shortcut Startup Programs TUTORIAL PHOTOSHOP Windows Administration Tools Create DVD Create DVD Maker Keyboard Network Set Up Security Security System Test DVD Test DVD Drive VGA Card VGA Conector VGA Informations CA-CLIPPER INTERNAL ERROR Crack Create PDF Create PDF using Smart PDF Creator Error windows explorer Hard Drive Partitioning Intall Windows 7 Ultimates Internet Browser Local Area Network Networking PDF EDITOR Protect CD from Copy Router Smart PDF Creator Tutorial Java USB REMOVE Word Password Remover Access Media Collection Adsense Animator Anomymity Computer Hang Computer Icon Computer Set Up D-Link D-Link Router DNS DVD Drive DVD compress Device Drive partitions Drive parts Earn Money Easy Gif Animator Elastomer Eror Solution External Hard Drive Facebook Free Internet Hack Password Hard Drive How to Download Inside Adsense Internet Explore JPEG JPG GIF PNG BMP Laptop Laptop vs PC MS Word to PDF Make DVD Make Money with blog Make Your Own Copy-Protected CD with Passive Protection Modem Ms Word Applications Online Shoping PC Desktop PDF Remover Partitions drive Picture Prevent Windows XP Print Printer Error Reboot Application Remove Pasword Excel Restore Windows Registry Search Engines Optimizer Social Networking Solving Probelm System Registry Upload File to blogger Upload Files Virtual Memory is to Low Viture Windows 7 Windows DVD Maker Wireless Wireless router Words error intall windows explorer cannot open words documents cannot open

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More