Typing comments in code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Typing comments in code

In my codes I want to type comments that don't show up in the final result of my program such as comments to the user.Or if I wanted to type something like " before you do this you must do that" without the message showing up in my code. How would I do this?

10th Jul 2017, 5:45 AM
C0D3X
C0D3X - avatar
2 Answers
+ 4
Double slash for commenting. System.out.println("Hello World") //This code displays Hello World in the screen but doesn't show this exact //2 lines of comment Edit: just noticed that you didn't want it to show up in the code. but that is not possible.
10th Jul 2017, 6:09 AM
MassiveMayhem
0
Years ago when I used WYSIWYG editors for HTML, they had options when you published your code to strip out comments. That is the only way I know of to have comments removed in your final versions. I suppose you could do the same with a find/replace, but that is asking for trouble if you ask me.
10th Jul 2017, 12:21 PM
Jim Tully
Jim Tully - avatar