ตัวอย่างการบรรยายพร้อมผู้ให้คำปรึกษาซึ่งเป็นส่วนหนึ่งของหลักสูตร Codegym University ลงทะเบียนสำหรับหลักสูตรเต็ม


"ว้าว เป็นมนุษย์ผู้หญิงอีกแล้ว! แต่คราวนี้ผมดำ ช่างน่าตื่นเต้นจริงๆ!"

“สวัสดี ฉันชื่อคิม”

“สวัสดี ฉันชื่ออามีโก้!”

“ฉันรู้ ฉันคิดชื่อคุณขึ้นมา ดิเอโกคงไม่ได้คิดแบบนั้น”

"กลับไปที่บทเรียนกันเถอะ ฉันจะใช้คำง่ายๆ เพื่ออธิบายเนื้อหาให้คุณฟัง"

"ตกลง."

"ฉันอยากจะเพิ่มคำสองสามคำที่ศาสตราจารย์และฤๅษีพูด"

"ใน Java คุณสามารถเขียนคำสั่งได้ แต่คุณยังสามารถเพิ่มความคิดเห็นลงในคำสั่งเหล่านั้นได้โดยตรงในโค้ด คอมไพเลอร์จะละเว้นความคิดเห็นโดยสิ้นเชิงเมื่อโปรแกรมทำงาน ความคิดเห็นทั้งหมดจะถูกละไว้ "

"ขอตัวอย่างหน่อยค่ะ"

"อ๋อ แน่นอน:"

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 ");
        System.out.print("Best");
    }
}

"เราได้เพิ่มความคิดเห็น 'ตอนนี้เราจะแสดงวลี...' จุดเริ่มต้นของความคิดเห็นจะแสดงด้วยสัญลักษณ์คู่ ( /*) และสิ้นสุดด้วย - โดย ( */) เมื่อโปรแกรมถูกคอมไพล์ คอมไพเลอร์จะละเว้นทุกอย่างระหว่าง สัญลักษณ์/*และ*/. "

"หมายความว่าฉันสามารถเขียนอะไรก็ได้ที่ฉันต้องการ?"

"ใช่ โดยปกติความคิดเห็นในโค้ดจะเกี่ยวกับส่วนต่างๆ ของโค้ดที่เข้าใจยาก บางความคิดเห็นประกอบด้วยสตริงนับสิบ ซึ่งมักจะเขียนก่อนเมธอดเพื่ออธิบายความแตกต่างในการทำงานของเมธอดเหล่านั้น"

"มีอีกวิธีหนึ่งในการเพิ่มความคิดเห็นในโค้ด คุณสามารถใช้เครื่องหมายทับสองตัว ( //)"

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

"ในที่นี้โค้ดที่ขึ้นต้นด้วย//และจนถึงท้ายบรรทัดด้วย // จะถือเป็นความคิดเห็น กล่าวอีกนัยหนึ่งคือไม่มีสัญลักษณ์คู่ที่สองที่ใช้ในการ 'แสดงความคิดเห็นให้สมบูรณ์'"

"ยังไงก็ตาม บางความคิดเห็นก็น่าสนใจจริงๆ"

// 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

"ใช่ บางคอมเมนต์ก็ตลกมาก"

"นั่นคือทั้งหมดสำหรับวันนี้"

"นั่นเป็นบทเรียนสั้นๆ แต่น่าสนใจ ขอบคุณ คิม"