Page 180 - การเขียนโปรแกรมบนมาตรฐานเปิด
P. 180

180




               ตัวอย่างของ trailing comments

               If (a ==2) {
                       return TRUE;         /* special case*/

               } else {

                       returnisPrime(a);    /*works only for odd a*/

                       }


               4.1.4 End-OF-Line comments

               เป็น Comments ที่ใช้สัญลักษณ์// น าคอมเมนต์ โดยมีตัวอย่างดังนี้

               if (foo>1)

               //Do a double-flip.
               ...

               }

               else

               return false.  //Explain why here.

               }
               //if (bar >1)

               //

               //  //Do a triple-flip.

               // ...

               //
               //else

               // return false

               //}




               4.2 Documentation Comment

                       Doc comments ใช้อธิบายลักษณะของclass, Interface, constructor, method และfield ในภาษา

               Java โดยที่ Doc documents นั้นจะยู่ภายในเครื่องหมาย /**...*/ และควรจัดให้ Doc documents ควรอยู่

               ก่อนการประกาศตัวแปร
   175   176   177   178   179   180   181   182   183   184   185