A lecture snippet with a mentor as part of the Codegym University course. Sign up for the full course.

"Wow, another human woman! But with black hair this time. How exciting!"

"Hi, my name is Kim."

"Hi, my name is Amigo!"

"I know. I came up with your name. Diego wouldn’t have thought that up."

"Let's get back to the lesson. I'll use simple words to explain the material to you."


"I'd like to add a few words to what the Professor and Rishi said."

"In Java, you can write commands, but you can also add comments to those commands right in the code. The compiler completely ignores the comments. When the program is run, all the comments are omitted."

"Give me an example, please."

"Oh, sure:"

public class Home
    public static void main(String[] args)
        Now we'll display the phrase 'Amigo Is The Best' on the screen
        System.out.print("Amigo ");
        System.out.print("Is ");
        System.out.print("The ");

"We added the comment 'Now we'll display the phrase…' The beginning of the comment is indicated by a pair of symbols (/*), and the end – by (*/). When the program is compiled, the compiler omits everything between the symbols /* and */."

"Does that mean that I can write anything I want?"

"Yes. Usually, comments in code are about parts of the code that are difficult to understand. Some comments consist of dozens of strings, often written before methods to describe nuances in how those methods work."

"There is one more way to add a comment to code. You can use two forward slashes (//)."

public class Home
    public static void main(String[] args)
        System.out.print("Amigo ");
        System.out.print("Is The "); // This is also a comment

"Here, the code starting with the // and up to the end of the line with the // is considered to be a comment. In other words, there is no second pair of symbols used to 'complete the comment'."

"By the way, some comments are really interesting."

// I'm not responsible of this code. They made me write it, against my will.
// Dear future me. Please forgive me.
// I can't even begin to express how sorry I am.
// If I see something like this once more, I'll have a complete mental breakdown at work.
// If this condition is ever satisfied,
// please inform me for a reward. Phone: xxx-xxx-xxx.
// Dear maintainer:
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// total_hours_wasted_here = 42
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
// Sometimes I believe compiler ignores all my comments.
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.
// Drunk, fix later
// Magic. Do not touch

"Yes, some comments are very funny."

"That's all for today."

"That was a short but interesting lesson. Thanks, Kim."