Friday, January 8, 2010

Programming help Java = What does // mean when there are words after it?

Hello





What does // mean in a java script when there is words after it? For example..





int least = Integer.MAX_VALUE; //assign the biggest val possible for default


boolean b = false; //boolean to check if there's at least 1 valid input








Do you include that in your program? Does the compiler or something not recognise the words after the // and it ignores it?








Im confused, thanks!Programming help Java = What does // mean when there are words after it?
It's a comment, just a note the programmer puts in for people reading his code. Also necessary for the programmer himself after six months. All the characters until the end of that line are ignored by the compiler.





Another way of making comments is to use the characters /* and */. Everything between /* and */ are ignored, even if there are end of lines in between.Programming help Java = What does // mean when there are words after it?
// Are java comments. Everything that comes (on the same line) after // is ignored by the Java compiler.


/* are


multi


line


comments */





They start with /* and end with */ everything between is ignored.





Similar comments also work on C/C++, C# and many other languages out there.





The compiler filter comments out, so it wont effect how your program will run.
that's for single line comment, you could have use /* */
It is a comment. The compiler ignores what is after //.


It is useful to annotate the program. You don't have to include comments, but it is a good idea. It helps you and other people who might edit the code understand what is going on.
That is a comment. It is for a human reading the code. It is ignored by the computer.





It's an essential tool for making code readable to people that didn't write it originally. It's also useful when returning to code you haven't seen in a while.





http://java.about.com/library/weekly/aa_鈥?/a>
The // that you see in programming code is put before comments from the programmer. The program ignores anything after the //. This lets the programmers keep notes to themselves and other programmers as to what they are doing in a particular line or block of code.
The words after // are comments.

No comments:

Post a Comment