Comments

code format="java" if (brick.hit(Brian)) //Makes Brian's virtual head explode when Brian.HeadExplode; //the user throws the virtual brick at him. code These comments help to avoid confusion as to what code means when code is transfered between programers, or not looked at for some time.
 * Comments** are used in Java as well as almost every other language to put plain-English comments into your code for reference, code explanation, or any other reason. All text in comments are completely disregarded by the program at compile time, and therefore can contain anything whatsoever without causing an error. Note the non-code, faded out areas below:

A comment is a note written to a human reader of a program. A comment starts with the two characters " // ". Those characters and everything that follows them on that one line are ignored by the java compiler. Comments can be placed // after // a program statement to explain what it does. It is also good to use comments at the beginning of each program to state your name and the name of the program you are creating. The two main way to make comments are: line comments and block comments. ** Line Comments ** are used to make comments on a single line and ** block comments ** are used to comment several lines of code. These are created by putting a slash-star (/*) at the beginning of the comment, and a star-slash (*/) at the end.

It is also good to use comments at the beginning of each program to state your name and the name of the program you are creating. The easiest way to do this is using block comments. This makes it easier for people like the wonderful Mr. Meermans to decipher the programs that his students (who are no where near as great and godly as he) attempt to create. You may want to begin your code with an informative title comment: code format="java" /* code
 * Student Name
 * Period
 * Name or Title of Program

Making Comments
There are two main ways to make comments in Java:


 * Line Comments** are used to make comments on a single line. They are created with two forward slashes (/), and anything typed on that line after them would be considered a comment.

code format="java" RectangleA.hide; //makes Gameboard invisible at start of app code

code format="java" /* ../\ /\ -Will not works! >(' ^ ')< . u u code
 * Block comments** are used to comment several lines of code, to more easily document gigantic descriptions, or ASCII art. These are created by putting a slash-star (/*) at the beginning of the comment, and a star-slash (*/) at the end:

Using Comments
A good comment doesn't need to explain //what// the code is doing--any programmer can already see what the code is doing by looking at it. Instead, good comments should be used to explain //why// the code is doing what it's doing. code format="java" q=(x[0]+x[1]+x[2])/3; //averages grades for GPA// code //**"Commenting Out"**// If you have a line of code giving you problems, instead of deleting it and then rewriting a similar one later, put a comment on it so you can deal with the rest of the program for the time being: code int whatever = 5; //whyWontThisCodeWork.wah(whine); code
 * //Explanation//**

Or, you can just //**screw around:**//

code format="java" yadaYadaYada.blahBlahBlah(Jabber); if (something.randomThingie==-1) blabber.hide; //Mr. Meermans is a doody-head. code