1. இரண்டு வகையான கருத்துகள்

மேலே சொன்னவற்றுடன் சில வார்த்தைகளைச் சேர்க்க வேண்டும்.

ஜாவாவில், நீங்கள் கட்டளைகளை எழுதலாம், ஆனால் குறியீட்டிலேயே அந்தக் கட்டளைகளுக்குக் கருத்துகளைச் சேர்க்கலாம். கம்பைலர் கருத்துகளை முற்றிலும் புறக்கணிக்கிறது. நிரல் இயங்கும் போது, ​​அனைத்து கருத்துகளும் தவிர்க்கப்படும்.

இங்கே ஒரு உதாரணம்:

public class Home
{
   public static void main (String[] args)
   {
      /*
      Now we'll display the phrase 'Amigo is the Best'
      */
      System.out.print("Amigo ");
      System.out.print("is 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");
   }
}

இங்கே, குறியீட்டில் தொடங்கி, //கோட்டின் இறுதி வரை உள்ள குறியீடு கருத்துக்களாகக் //கருதப்படுகிறது. வேறு வார்த்தைகளில் கூறுவதானால், 'கருத்தை முடிக்க' பயன்படுத்தப்படும் இரண்டாவது ஜோடி குறியீடுகள் இல்லை.


2. புரோகிராமர்களின் வாழ்க்கையிலிருந்து கருத்துகள்

மூலம், சில கருத்துகள் மிகவும் சுவாரஸ்யமானவை.

// I'm not responsible for this code. I was forced to write it against my will.
// Dear, future me. Please forgive me for this code.
// 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 programmer:
//
// When you finish 'optimizing' this subroutine
// and realize what a huge mistake it 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 only God knows.
// Sometimes it seems that the compiler is just ignoring all my comments
// I dedicate all my code and my work to my wife Darlene,
// who will have to provide for me, our three kids, and the dog when
// it gets released to the public.
// Magic. Don't touch.

ஆம், சில கருத்துக்கள் மிகவும் வேடிக்கையானவை.